Hi All, 

The latest version of V8Power Tools for DOS is now available. 

It includes the new VTEST beta for general testing.

It can be downloaded at https://up.lod.bz/v8power <https://up.lod.bz/v8power> 
or https://fd.lod.bz/repos/current/pkg-html/v8power.html 
<https://fd.lod.bz/repos/current/pkg-html/v8power.html>

Some general information on usage:

VTEST exists with one of 3 exit codes, 0=TRUE, 1=FALSE, 100=Syntax or invalid 
option error. 

By default, only error messages are displayed.

There is a /tf option than can be placed anywhere on the command line to 
display the final result of TRUE, FALSE or ERROR.

When comparing any two strings, it will attempt to compare them numerically by 
default (supporting signed 64-bit integers in decimal or hexadecimal). For 
example 123 is less than 0456. If either of the strings is not a valid number, 
they will be compared as non-case specific text. You can force the strings  to 
be compared as text by using either /i (case-less) or /c (case-specific) at the 
start of an expression. Examples:

C:>VTEST /tf 123 /gt 0456
FALSE
C:>VTEST /tf 0x1234 /gt -456
TRUE
C:>VTEST /tf 0x1234 /lt 1234
FALSE
C:>VTEST /tf /i 123 /gt 0456
TRUE
C:>VTEST /tf abc /eq ABC
TRUE
C:>VTEST /tf /c abc /eq ABC
FALSE

Quotations for strings is not used or required. Quotation characters are 
treated as string text. Also, leading and trailing whitespace in strings is 
ignored. (however, at least one space is required after an option)

C:>VTEST /tf a b c         /eq     A B C
TRUE
C:>VTEST /tf a bc /eq A B C
FALSE
C:>VTEST /tf abc/eq    ABC
TRUE
The / character must be escaped in strings by using //.

C:>VTEST /tf Y//N
TRUE
C:>VTEST /tf a/b
Invalid option “/b”.
ERROR
(That is because no operand (like /GT or /AND is between “Y” and “/N”)

Missing strings are interpreted as NULL strings.

C:>VTEST /tf /lt hello
TRUE
C:>VTEST /tf /gt hello
FALSE
C:>VTEST /tf 1 /gt
TRUE
C:>VTEST /tf 1 /lt
FALSE
C:>VTEST /eq/tf
TRUE
C:>VTEST /tf /ne
FALSE

Comparisons are made from left to right and can be strung in a sequence.

C:>VTEST /tf 3 /lt 5 /gt 2
TRUE
(That would be like “3 < 5” then “5 > 2")


Test expressions can be chained using /AND or /OR

C:>VTEST /tf 3 /lt 5 /and B /gt a
TRUE
(That would be like “3 < 5” and case-less “B > A")


Entire expressions can be negated using /NOT.

C:>VTEST /tf /not 3 /lt 5 /gt 2 /or /not /c B /gt a
TRUE
(That would be like "NOT (3 < 5 > 2 = TRUE) = FALSE”  or "NOT (case specific, B 
> a = FALSE) = TRUE")


When a filesystem test is made using /f (file), /d (directory) or /e (exists), 
the item string is replaced by the on disk value. For example assume file 
“Hello program 1.h" exists:

C:>VTEST /tf /f hello program 1.h
TRUE
C:>VTEST /tf /c /f hello program 1.h
FALSE
C:>VTEST /tf /f Hello program 1.h /eq hello program 1.h
TRUE
C:>VTEST /c /tf /f Hello program 1.h /eq hello program 1.h
FALSE
C:>VTEST /c /tf /f Hello program 1.h /or /f HELLO-1.H
TRUE

Wildcards can be used with file system items.

C:>VTEST /tf /d C:\FREEDOS
TRUE
C:>VTEST /tf /f C:\FREEDOS\BIN\*.*
TRUE

The Exists option (/e) is a little different from /f and /d. It can be used to 
test for any type directory entry, including system volume labels.

C:>VTEST /tf /e C:\FREEDOS2.012
TRUE

Known Limitations regarding the filesystem related tests:

The /f, /d and /e options are only permitted at the beginning of an expression 
at present. A little extra overhead would be required to permit things like 
“VTEST hello /eq /f HELLO” and I haven’t decided if that is worth the effort.

It may be useful to add tests for date/time stamps and size.

It may be useful to add some drive type tests. Like is removable media, cd-rom, 
floppy, etc.

The /f and /d options to not care if a file is system or hidden. Perhaps tests 
for those will be added at some point.

At present where wildcards are used, only the first matching filesystem item is 
compared from the unsorted directory. It may be useful to test all matching 
directory items.  Making it possible to compare against all files/dirs. For 
example, any file is older than DT. Or, possibly File A is older than File B, 
etc. However, not sure how much use it would be. Maybe later.

On a single floppy system, running “VTEST /d a:\ /and /d b:\” will cause DOS to 
prompt for a disk swap. I have not decided if this “is worth the effort” or 
"even should be” prevented. 

Anyhow, it is available now. Have fun testing it. 

:-)

Jerome



_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to