2012-10-02 21:14 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/hbct/tests/*.prg
  * tests/tstuse.prg
    * cleanups (mostly QOUT() -> ?)
    ; hbrun works beautifully with tests, finally I don't have
      to build them to exe to run them.
This commit is contained in:
Viktor Szakats
2012-10-02 19:18:00 +00:00
parent 5099fba567
commit 73eb69ec3a
55 changed files with 880 additions and 873 deletions

View File

@@ -16,6 +16,13 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-02 21:14 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbct/tests/*.prg
* tests/tstuse.prg
* cleanups (mostly QOUT() -> ?)
; hbrun works beautifully with tests, finally I don't have
to build them to exe to run them.
2012-10-02 20:35 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbamf/tests/tstendin.prg
* contrib/hbgt/tests/test.prg

View File

@@ -60,48 +60,48 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ADDASCII()" )
QOut( "" )
? "Begin test of ADDASCII()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ This should be "1000": ] + addascii( "0000", 1, 1 ) )
QOut( [ This should be "0001": ] + addascii( "0000", 1 ) )
QOut( [ This should be "BAAA": ] + addascii( "AAAA", - 255, 1 ) )
QOut( [ This should be "AAAB": ] + addascii( "AAAA", - 255 ) )
? "Simple tests:"
? [ This should be "1000": ] + addascii( "0000", 1, 1 )
? [ This should be "0001": ] + addascii( "0000", 1 )
? [ This should be "BAAA": ] + addascii( "AAAA", - 255, 1 )
? [ This should be "AAAB": ] + addascii( "AAAA", - 255 )
// csetref() tests
QOut()
QOut( "CSETREF tests:" )
QOut( " current csetref setting(should be .f.)................: ", csetref() )
QOut( " return value of addascii([A],1,1) call(should be 'B'): ", addascii( "A",1,1 ) )
QOut( " value of cStr..........................................: ", cStr )
QOut( " return value of addascii(cStr,1,1) call...............: ", addascii( cStr,1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of addascii(@cStr,1,1) call..............: ", addascii( @cStr,1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of addascii(@cStr,-1,1) call.............: ", addascii( @cStr, - 1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of csetref(.t.)..........................: ", csetref( .T. ) )
QOut( " return value of addascii([A],1,1) call................: ", addascii( "A",1,1 ) )
QOut( " return value of addascii(cStr,1,1) call...............: ", addascii( cStr,1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of addascii(@cStr,1,1) call..............: ", addascii( @cStr,1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of addascii(@cStr,-1,1) call.............: ", addascii( @cStr, - 1,1 ) )
QOut( " value of cStr is now...................................: ", cStr )
QOut( " return value of csetref(.f.)..........................: ", csetref( .F. ) )
?
? "CSETREF tests:"
? " current csetref setting(should be .f.)................: ", csetref()
? " return value of addascii([A],1,1) call(should be 'B'): ", addascii( "A",1,1 )
? " value of cStr..........................................: ", cStr
? " return value of addascii(cStr,1,1) call...............: ", addascii( cStr,1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of addascii(@cStr,1,1) call..............: ", addascii( @cStr,1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of addascii(@cStr,-1,1) call.............: ", addascii( @cStr, - 1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of csetref(.t.)..........................: ", csetref( .T. )
? " return value of addascii([A],1,1) call................: ", addascii( "A",1,1 )
? " return value of addascii(cStr,1,1) call...............: ", addascii( cStr,1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of addascii(@cStr,1,1) call..............: ", addascii( @cStr,1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of addascii(@cStr,-1,1) call.............: ", addascii( @cStr, - 1,1 )
? " value of cStr is now...................................: ", cStr
? " return value of csetref(.f.)..........................: ", csetref( .F. )
// tests for the new 4th parameter
QOut()
QOut( "Carryover tests(new 4th parameter):" )
QOut( " return value of addascii([AAAA],1,2,.T.) call('ABAA')....:", addascii( "AAAA",1,2, .T. ) )
QOut( " return value of addascii([AAAA],257,2,.T.) call('BBAA')..:", addascii( "AAAA",257,2, .T. ) )
QOut( " return value of addascii([AAAA],257,2,.F.) call('ABAA')..:", addascii( "AAAA",257,2, .F. ) )
QOut( " return value of addascii([AAAA],258,,.T.) call('AABC')...:", addascii( "AAAA",258,, .T. ) )
QOut( " return value of addascii([ABBA],-257,3,.T.) call('AAAA').:", addascii( "ABBA", - 257,3, .T. ) )
?
? "Carryover tests(new 4th parameter):"
? " return value of addascii([AAAA],1,2,.T.) call('ABAA')....:", addascii( "AAAA",1,2, .T. )
? " return value of addascii([AAAA],257,2,.T.) call('BBAA')..:", addascii( "AAAA",257,2, .T. )
? " return value of addascii([AAAA],257,2,.F.) call('ABAA')..:", addascii( "AAAA",257,2, .F. )
? " return value of addascii([AAAA],258,,.T.) call('AABC')...:", addascii( "AAAA",258,, .T. )
? " return value of addascii([ABBA],-257,3,.T.) call('AAAA').:", addascii( "ABBA", - 257,3, .T. )
QOut( "End test of ADDASCII()" )
QOut( "" )
? "End test of ADDASCII()"
?
ctexit()

View File

@@ -60,49 +60,49 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of AFTERATNUM()" )
QOut( "" )
QOut( " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 ) )
QOut( "" )
? "Begin test of AFTERATNUM()"
?
? " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 )
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ afteratnum("..",cStr) should be "test!",] )
QOut( [ and is "] + afteratnum( "..", cStr ) + ["] )
QOut( [ afteratnum("..",cStr,2) should be ".is...a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2 ) + ["] )
QOut( [ afteratnum("..",cStr,2,2) should be ".a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["] )
QOut()
? " Simple tests:"
? [ afteratnum("..",cStr) should be "test!",]
? [ and is "] + afteratnum( "..", cStr ) + ["]
? [ afteratnum("..",cStr,2) should be ".is...a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2 ) + ["]
? [ afteratnum("..",cStr,2,2) should be ".a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["]
?
// Tests with CSetAtMuPa(.T.)
QOut( " Multi-Pass tests" )
QOut( " Setting csetatmupa() to .T." )
? " Multi-Pass tests"
? " Setting csetatmupa() to .T."
csetatmupa( .T. )
QOut( [ afteratnum("..",cStr) should be "test!",] )
QOut( [ and is "] + afteratnum( "..", cStr ) + ["] )
QOut( [ afteratnum("..",cStr,2) should be "This...is...a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2 ) + ["] )
QOut( [ afteratnum("..",cStr,2,2) should be "is...a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["] )
QOut( " Setting csetatmupa() to .F." )
? [ afteratnum("..",cStr) should be "test!",]
? [ and is "] + afteratnum( "..", cStr ) + ["]
? [ afteratnum("..",cStr,2) should be "This...is...a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2 ) + ["]
? [ afteratnum("..",cStr,2,2) should be "is...a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["]
? " Setting csetatmupa() to .F."
csetatmupa( .F. )
QOut()
?
// Tests mit SetAtlike(1)
QOut( " SetAtLike tests" )
QOut( [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")] )
? " SetAtLike tests"
? [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")]
setatlike( CT_SETATLIKE_WILDCARD, "." )
QOut( [ afteratnum("..",cStr) should be "",] )
QOut( [ and is "] + afteratnum( "..", cStr ) + ["] )
QOut( [ afteratnum("..",cStr,2,2) should be "s...is...a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["] )
QOut( [ afteratnum("..",cStr,2,10) should be ".a...test!",] )
QOut( [ and is "] + afteratnum( "..", cStr, 2, 10 ) + ["] )
QOut()
? [ afteratnum("..",cStr) should be "",]
? [ and is "] + afteratnum( "..", cStr ) + ["]
? [ afteratnum("..",cStr,2,2) should be "s...is...a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2, 2 ) + ["]
? [ afteratnum("..",cStr,2,10) should be ".a...test!",]
? [ and is "] + afteratnum( "..", cStr, 2, 10 ) + ["]
?
QOut( "End test of AFTERATNUM()" )
QOut()
? "End test of AFTERATNUM()"
?
ctexit()

View File

@@ -58,16 +58,16 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ASCIISUM()" )
QOut( "" )
? "Begin test of ASCIISUM()"
?
QOut( [ asciisum(replicate("A", 10000)) == 650000 ? --> ] + Str( asciisum(Replicate("A",10000 ) ) ) )
QOut( [ asciisum("0123456789") == 525 ? --> ] + Str( asciisum("0123456789" ) ) )
QOut( [ asciisum(nil) == 0 ? --> ] + Str( asciisum(nil ) ) )
? [ asciisum(replicate("A", 10000)) == 650000 ? --> ] + Str( asciisum(Replicate("A",10000 ) ) )
? [ asciisum("0123456789") == 525 ? --> ] + Str( asciisum("0123456789" ) )
? [ asciisum(nil) == 0 ? --> ] + Str( asciisum(nil ) )
QOut( "" )
QOut( "End test of ASCIISUM()" )
QOut( "" )
?
? "End test of ASCIISUM()"
?
ctexit()

View File

@@ -58,16 +58,16 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ASCPOS()" )
QOut( "" )
? "Begin test of ASCPOS()"
?
QOut( [ ascpos("0123456789") == 57 ? --> ] + Str( ascpos("0123456789" ) ) )
QOut( [ ascpos("0123456789",1) == 48 ? --> ] + Str( ascpos("0123456789",1 ) ) )
QOut( [ ascpos("0123456789",11) == 0 ? --> ] + Str( ascpos("0123456789",11 ) ) )
? [ ascpos("0123456789") == 57 ? --> ] + Str( ascpos("0123456789" ) )
? [ ascpos("0123456789",1) == 48 ? --> ] + Str( ascpos("0123456789",1 ) )
? [ ascpos("0123456789",11) == 0 ? --> ] + Str( ascpos("0123456789",11 ) )
QOut( "" )
QOut( "End test of ASCPOS()" )
QOut( "" )
?
? "End test of ASCPOS()"
?
ctexit()

View File

@@ -66,37 +66,37 @@ PROCEDURE Main()
ctinit()
// Some simple tests
QOut( "Begin test of ATADJUST()" )
QOut( "" )
? "Begin test of ATADJUST()"
?
QOut( " Original strings:" )
? " Original strings:"
for ni := 1 TO Len( aStr )
QOut( Space( 4 ) + aStr[ni] )
? Space( 4 ) + aStr[ni]
next
QOut( "" )
?
QOut( ' ATADJUST(":", aStr[ni], 21,,, ".") yields' )
? ' ATADJUST(":", aStr[ni], 21,,, ".") yields'
for ni := 1 TO Len( aStr )
QOut( Space( 4 ) + atadjust( ":", aStr[ni], 21, 1,,"." ) )
? Space( 4 ) + atadjust( ":", aStr[ni], 21, 1,,"." )
next
QOut( "" )
?
QOut( ' ATADJUST(":", aStr[ni], 10, 1,, ".") yields' )
? ' ATADJUST(":", aStr[ni], 10, 1,, ".") yields'
for ni := 1 TO Len( aStr )
QOut( Space( 4 ) + atadjust( ":", aStr[ni], 10, 1,,"." ) )
? Space( 4 ) + atadjust( ":", aStr[ni], 10, 1,,"." )
next
QOut( "" )
?
QOut( ' SETATLIKE(CT_SETATLIKE_WILDCARD, ":")' )
QOut( ' ATADJUST(":", aStr[ni], 10, 1,, ".") yields now' )
? ' SETATLIKE(CT_SETATLIKE_WILDCARD, ":")'
? ' ATADJUST(":", aStr[ni], 10, 1,, ".") yields now'
setatlike( CT_SETATLIKE_WILDCARD, ":" )
for ni := 1 TO Len( aStr )
QOut( Space( 4 ) + atadjust( ":", aStr[ni], 10, 1,,"." ) )
? Space( 4 ) + atadjust( ":", aStr[ni], 10, 1,,"." )
next
QOut( "" )
?
QOut( "End test of ATADJUST()" )
QOut( "" )
? "End test of ATADJUST()"
?
ctexit()

View File

@@ -60,49 +60,49 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ATNUM()" )
QOut( "" )
QOut( " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 ) )
QOut( "" )
? "Begin test of ATNUM()"
?
? " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 )
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ atnum("..",cStr) should be 18,] )
QOut( [ and is ], atnum( "..", cStr ) )
QOut( [ atnum("..",cStr,2) should be 8,] )
QOut( [ and is ], atnum( "..", cStr, 2 ) )
QOut( [ atnum("..",cStr,2,2) should be 13,] )
QOut( [ and is ], atnum( "..", cStr, 2, 2 ) )
QOut()
? " Simple tests:"
? [ atnum("..",cStr) should be 18,]
? [ and is ], atnum( "..", cStr )
? [ atnum("..",cStr,2) should be 8,]
? [ and is ], atnum( "..", cStr, 2 )
? [ atnum("..",cStr,2,2) should be 13,]
? [ and is ], atnum( "..", cStr, 2, 2 )
?
// Tests with CSetAtMuPa(.T.)
QOut( " Multi-Pass tests" )
QOut( " Setting csetatmupa() to .T." )
? " Multi-Pass tests"
? " Setting csetatmupa() to .T."
csetatmupa( .T. )
QOut( [ atnum("..",cStr) should be 18,] )
QOut( [ and is ], atnum( "..", cStr ) )
QOut( [ atnum("..",cStr,2) should be 2,] )
QOut( [ and is ], atnum( "..", cStr, 2 ) )
QOut( [ atnum("..",cStr,2,2) should be 9,] )
QOut( [ and is ], atnum( "..", cStr, 2, 2 ) )
QOut( " Setting csetatmupa() to .F." )
? [ atnum("..",cStr) should be 18,]
? [ and is ], atnum( "..", cStr )
? [ atnum("..",cStr,2) should be 2,]
? [ and is ], atnum( "..", cStr, 2 )
? [ atnum("..",cStr,2,2) should be 9,]
? [ and is ], atnum( "..", cStr, 2, 2 )
? " Setting csetatmupa() to .F."
csetatmupa( .F. )
QOut()
?
// Tests mit SetAtlike(1)
QOut( " SetAtLike tests" )
QOut( [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")] )
? " SetAtLike tests"
? [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")]
setatlike( CT_SETATLIKE_WILDCARD, "." )
QOut( [ atnum("..",cStr) should be 23,] )
QOut( [ and is ], atnum( "..", cStr ) )
QOut( [ atnum("..",cStr,2,2) should be 5,] )
QOut( [ and is ], atnum( "..", cStr, 2, 2 ) )
QOut( [ atnum("..",cStr,2,10) should be 13,] )
QOut( [ and is ], atnum( "..", cStr, 2, 10 ) )
QOut()
? [ atnum("..",cStr) should be 23,]
? [ and is ], atnum( "..", cStr )
? [ atnum("..",cStr,2,2) should be 5,]
? [ and is ], atnum( "..", cStr, 2, 2 )
? [ atnum("..",cStr,2,10) should be 13,]
? [ and is ], atnum( "..", cStr, 2, 10 )
?
QOut( "End test of ATNUM()" )
QOut()
? "End test of ATNUM()"
?
ctexit()

View File

@@ -58,21 +58,21 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ATREPL()" )
QOut( "" )
? "Begin test of ATREPL()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ atrepl("ABC", "ABCDABCDABC", "xx") == "xxDxxDxx" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx" ) + ["] )
QOut( [ atrepl("ABC", "ABCDABC", "ZYXW") == "ZYXWDZYXW" ? --> "] + atrepl( "ABC", "ABCDABC", "ZYXW" ) + ["] )
QOut( [ atrepl("ABC", "ABCDABCDABC", "xx", 2) == "xxDxxDABC" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2 ) + ["] )
QOut( [ atrepl("ABC", "ABCDABCDABC", "xx", 2, .T.) == "ABCDxxDABC" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2, .T. ) + ["] )
QOut( [ atrepl("ABC", "ABCDABCDABC", "xx", 2, .T., 1) == "ABCDABCDxx" ? ] )
QOut( [ --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2, .T. , 1 ) + ["] )
? [ atrepl("ABC", "ABCDABCDABC", "xx") == "xxDxxDxx" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx" ) + ["]
? [ atrepl("ABC", "ABCDABC", "ZYXW") == "ZYXWDZYXW" ? --> "] + atrepl( "ABC", "ABCDABC", "ZYXW" ) + ["]
? [ atrepl("ABC", "ABCDABCDABC", "xx", 2) == "xxDxxDABC" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2 ) + ["]
? [ atrepl("ABC", "ABCDABCDABC", "xx", 2, .T.) == "ABCDxxDABC" ? --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2, .T. ) + ["]
? [ atrepl("ABC", "ABCDABCDABC", "xx", 2, .T., 1) == "ABCDABCDxx" ? ]
? [ --> "] + atrepl( "ABC", "ABCDABCDABC", "xx", 2, .T. , 1 ) + ["]
QOut( "End test of ATREPL()" )
QOut( "" )
? "End test of ATREPL()"
?
ctexit()

View File

@@ -61,29 +61,29 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of ATTOKEN()" )
QOut( "" )
? "Begin test of ATTOKEN()"
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ attoken("Hello, World!") == 8 ? ---------> ] + Str( attoken("Hello, World!" ) ) )
QOut( [ attoken("Hello, World!",,2) == 8 ? ------> ] + Str( attoken("Hello, World!",,2 ) ) )
QOut( [ attoken("Hello, World!",,2,1) == 7 ? ----> ] + Str( attoken("Hello, World!",,2,1 ) ) )
QOut( [ attoken("Hello, World!"," ",2,1) == 8 ? -> ] + Str( attoken("Hello, World!"," ",2,1 ) ) )
QOut( "" )
? " Simple tests:"
? [ attoken("Hello, World!") == 8 ? ---------> ] + Str( attoken("Hello, World!" ) )
? [ attoken("Hello, World!",,2) == 8 ? ------> ] + Str( attoken("Hello, World!",,2 ) )
? [ attoken("Hello, World!",,2,1) == 7 ? ----> ] + Str( attoken("Hello, World!",,2,1 ) )
? [ attoken("Hello, World!"," ",2,1) == 8 ? -> ] + Str( attoken("Hello, World!"," ",2,1 ) )
?
QOut( [ Tokenizing a string with skip width == 1 and ".!" as tokenizer list:] )
QOut( " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 ) )
QOut( "" )
? [ Tokenizing a string with skip width == 1 and ".!" as tokenizer list:]
? " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 )
?
for ni := 1 TO numtoken( cStr, ".!", 1 )
QOut( [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".!", ni, 1 ) + [")] )
QOut( " starts at pos " + Str( npos := attoken(cStr, ".!", ni, 1 ),3 ) + ;
? [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".!", ni, 1 ) + [")]
? " starts at pos " + Str( npos := attoken(cStr, ".!", ni, 1 ),3 ) + ;
" and is " + iif( SubStr( cStr,npos,1 ) $ ".!", "", "not " ) + "an empty token." )
next ni
QOut( "" )
QOut( "End test of ATTOKEN()" )
QOut()
?
? "End test of ATTOKEN()"
?
ctexit()

View File

@@ -60,49 +60,49 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of BEFORATNUM()" )
QOut( "" )
QOut( " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 ) )
QOut( "" )
? "Begin test of BEFORATNUM()"
?
? " Value of cStr is:" + Chr( 34 ) + cStr + Chr( 34 )
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ beforatnum("..",cStr) should be "...This...is...a.",] )
QOut( [ and is "] + beforatnum( "..", cStr ) + ["] )
QOut( [ beforatnum("..",cStr,2) should be "...This",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2 ) + ["] )
QOut( [ beforatnum("..",cStr,2,2) should be "...This...is",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["] )
QOut()
? " Simple tests:"
? [ beforatnum("..",cStr) should be "...This...is...a.",]
? [ and is "] + beforatnum( "..", cStr ) + ["]
? [ beforatnum("..",cStr,2) should be "...This",]
? [ and is "] + beforatnum( "..", cStr, 2 ) + ["]
? [ beforatnum("..",cStr,2,2) should be "...This...is",]
? [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["]
?
// Tests with CSetAtMuPa(.T.)
QOut( " Multi-Pass tests" )
QOut( " Setting csetatmupa() to .T." )
? " Multi-Pass tests"
? " Setting csetatmupa() to .T."
csetatmupa( .T. )
QOut( [ beforatnum("..",cStr) should be "...This...is...a.",] )
QOut( [ and is "] + beforatnum( "..", cStr ) + ["] )
QOut( [ beforatnum("..",cStr,2) should be ".",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2 ) + ["] )
QOut( [ beforatnum("..",cStr,2,2) should be "...This.",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["] )
QOut( " Setting csetatmupa() to .F." )
? [ beforatnum("..",cStr) should be "...This...is...a.",]
? [ and is "] + beforatnum( "..", cStr ) + ["]
? [ beforatnum("..",cStr,2) should be ".",]
? [ and is "] + beforatnum( "..", cStr, 2 ) + ["]
? [ beforatnum("..",cStr,2,2) should be "...This.",]
? [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["]
? " Setting csetatmupa() to .F."
csetatmupa( .F. )
QOut()
?
// Tests mit SetAtlike(1)
QOut( " SetAtLike tests" )
QOut( [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")] )
? " SetAtLike tests"
? [ Setting setatlike(CT_SETATLIKE_WILDCARD, ".")]
setatlike( CT_SETATLIKE_WILDCARD, "." )
QOut( [ beforatnum("..",cStr) should be "...This...is...a...tes",] )
QOut( [ and is "] + beforatnum( "..", cStr ) + ["] )
QOut( [ beforatnum("..",cStr,2,2) should be "...T",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["] )
QOut( [ beforatnum("..",cStr,2,10) should be "...This...is",] )
QOut( [ and is "] + beforatnum( "..", cStr, 2, 10 ) + ["] )
QOut()
? [ beforatnum("..",cStr) should be "...This...is...a...tes",]
? [ and is "] + beforatnum( "..", cStr ) + ["]
? [ beforatnum("..",cStr,2,2) should be "...T",]
? [ and is "] + beforatnum( "..", cStr, 2, 2 ) + ["]
? [ beforatnum("..",cStr,2,10) should be "...This...is",]
? [ and is "] + beforatnum( "..", cStr, 2, 10 ) + ["]
?
QOut( "End test of BEFORATNUM()" )
QOut()
? "End test of BEFORATNUM()"
?
ctexit()

View File

@@ -58,18 +58,18 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARADD()" )
QOut( "" )
? "Begin test of CHARADD()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charadd("012345678", chr(1)) == "123456789" ? -> "] + charadd( "012345678", Chr(1 ) ) + ["] )
QOut( [ charadd("012345678", chr(1)+chr(2)) == "133557799" ? -> "] + charadd( "012345678", Chr(1 ) + Chr(2 ) ) + ["] )
QOut( [ charadd("123456789", chr(255)) == "012345678" ? -> "] + charadd( "123456789", Chr(255 ) ) + ["] )
QOut( [ charadd("123456789", chr(255)+chr(254)) == "002244668" ? -> "] + charadd( "123456789", Chr(255 ) + Chr(254 ) ) + ["] )
? "Simple tests:"
? [ charadd("012345678", chr(1)) == "123456789" ? -> "] + charadd( "012345678", Chr(1 ) ) + ["]
? [ charadd("012345678", chr(1)+chr(2)) == "133557799" ? -> "] + charadd( "012345678", Chr(1 ) + Chr(2 ) ) + ["]
? [ charadd("123456789", chr(255)) == "012345678" ? -> "] + charadd( "123456789", Chr(255 ) ) + ["]
? [ charadd("123456789", chr(255)+chr(254)) == "002244668" ? -> "] + charadd( "123456789", Chr(255 ) + Chr(254 ) ) + ["]
QOut( "End test of CHARADD()" )
QOut( "" )
? "End test of CHARADD()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARAND()" )
QOut( "" )
? "Begin test of CHARAND()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ charand("012345678", chr(254)) == "002244668" ? --> "] + charand( "012345678", Chr(254 ) ) + ["] )
QOut( [ charand("012345678", chr(254)+chr(252)) == "002044648" ? --> "] + charand( "012345678", Chr(254 ) + Chr(252 ) ) + ["] )
? [ charand("012345678", chr(254)) == "002244668" ? --> "] + charand( "012345678", Chr(254 ) ) + ["]
? [ charand("012345678", chr(254)+chr(252)) == "002044648" ? --> "] + charand( "012345678", Chr(254 ) + Chr(252 ) ) + ["]
QOut( "End test of CHARAND()" )
QOut( "" )
? "End test of CHARAND()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHAREVEN()" )
QOut( "" )
? "Begin test of CHAREVEN()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ chareven(" 1 2 3 4 5") == "12345" ? --> "] + chareven( " 1 2 3 4 5" ) + ["] )
QOut( [ chareven(" 1 2 3 4 ") == "1234" ? --> "] + chareven( " 1 2 3 4 " ) + ["] )
QOut( [ chareven(" ") == "" ? --> "] + chareven( " " ) + ["] )
? "Simple tests:"
? [ chareven(" 1 2 3 4 5") == "12345" ? --> "] + chareven( " 1 2 3 4 5" ) + ["]
? [ chareven(" 1 2 3 4 ") == "1234" ? --> "] + chareven( " 1 2 3 4 " ) + ["]
? [ chareven(" ") == "" ? --> "] + chareven( " " ) + ["]
QOut( "End test of CHAREVEN()" )
QOut( "" )
? "End test of CHAREVEN()"
?
ctexit()

View File

@@ -60,18 +60,18 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARHIST()" )
QOut( "" )
? "Begin test of CHARHIST()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charhist("Hello World !")] + "[109] == 3 ? --> ", charhist( "Hello World !" )[ 109 ] )
QOut( [ aeval(charhist("Hello World !"), {| x | nTotal += x } ) ] )
? "Simple tests:"
? [ charhist("Hello World !")] + "[109] == 3 ? --> ", charhist( "Hello World !" )[ 109 ]
? [ aeval(charhist("Hello World !"), {| x | nTotal += x } ) ]
AEval( charhist( "Hello World !" ), {| x | nTotal += x } )
QOut( [ ==> nTotal == len("Hello World !") ? --> ], nTotal == Len( "Hello World !" ) )
? [ ==> nTotal == len("Hello World !") ? --> ], nTotal == Len( "Hello World !" )
QOut( "End test of CHARHIST()" )
QOut( "" )
? "End test of CHARHIST()"
?
ctexit()

View File

@@ -58,16 +58,16 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARLIST()" )
QOut( "" )
? "Begin test of CHARLIST()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charlist("Hello World !") == "Helo Wrd!" ? -> "] + charlist( "Hello World !" ) + ["] )
QOut( [ charlist(nil) == "" ? -> "] + charlist( nil ) + ["] )
? "Simple tests:"
? [ charlist("Hello World !") == "Helo Wrd!" ? -> "] + charlist( "Hello World !" ) + ["]
? [ charlist(nil) == "" ? -> "] + charlist( nil ) + ["]
QOut( "End test of CHARLIST()" )
QOut( "" )
? "End test of CHARLIST()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARMIRR()" )
QOut( "" )
? "Begin test of CHARMIRR()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charmirr("racecar") == "racecar" ? ----------> "] + charmirr( "racecar" ) + ["] )
QOut( [ charmirr("racecar ", .T.) == "racecar " ? -> "] + charmirr( "racecar ", .T. ) + ["] )
QOut( [ charmirr("racecar ", .F.) == " racecar" ? -> "] + charmirr( "racecar ", .F. ) + ["] )
? "Simple tests:"
? [ charmirr("racecar") == "racecar" ? ----------> "] + charmirr( "racecar" ) + ["]
? [ charmirr("racecar ", .T.) == "racecar " ? -> "] + charmirr( "racecar ", .T. ) + ["]
? [ charmirr("racecar ", .F.) == " racecar" ? -> "] + charmirr( "racecar ", .F. ) + ["]
QOut( "End test of CHARMIRR()" )
QOut( "" )
? "End test of CHARMIRR()"
?
ctexit()

View File

@@ -58,20 +58,20 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARMIX()" )
QOut( "" )
? "Begin test of CHARMIX()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charmix("ABC", "123") == "A1B2C3" ? --> "] + charmix( "ABC", "123" ) + ["] )
QOut( [ charmix("ABCDE", "12") == "A1B2C1D2E1" ? --> "] + charmix( "ABCDE", "12" ) + ["] )
QOut( [ charmix("AB", "12345") == "A1B2" ? --> "] + charmix( "AB", "12345" ) + ["] )
QOut( [ charmix("HELLO", " ") == "H E L L O " ? --> "] + charmix( "HELLO", " " ) + ["] )
QOut( [ charmix("HELLO", "") == "HELLO" ? --> "] + charmix( "HELLO", "" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charmix("ABC", "123") == "A1B2C3" ? --> "] + charmix( "ABC", "123" ) + ["]
? [ charmix("ABCDE", "12") == "A1B2C1D2E1" ? --> "] + charmix( "ABCDE", "12" ) + ["]
? [ charmix("AB", "12345") == "A1B2" ? --> "] + charmix( "AB", "12345" ) + ["]
? [ charmix("HELLO", " ") == "H E L L O " ? --> "] + charmix( "HELLO", " " ) + ["]
? [ charmix("HELLO", "") == "HELLO" ? --> "] + charmix( "HELLO", "" ) + ["]
?
QOut( "End test of CHARMIX()" )
QOut( "" )
? "End test of CHARMIX()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARNOLIST()" )
QOut( "" )
? "Begin test of CHARNOLIST()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ charnolist(charnolist("Hello World !")) == " !HWdelor" ? -> "] + charnolist( charnolist("Hello World !" ) ) + ["] )
QOut( [ charnolist(charnolist(nil)) == ""? -> "] + charnolist( charnolist(nil ) ) + ["] )
? [ charnolist(charnolist("Hello World !")) == " !HWdelor" ? -> "] + charnolist( charnolist("Hello World !" ) ) + ["]
? [ charnolist(charnolist(nil)) == ""? -> "] + charnolist( charnolist(nil ) ) + ["]
QOut( "End test of CHARNOLIST()" )
QOut( "" )
? "End test of CHARNOLIST()"
?
ctexit()

View File

@@ -60,31 +60,31 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARNOT()" )
QOut( "" )
? "Begin test of CHARNOT()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ charnot(chr(85)+chr(128)+chr(170)+chr(1)) == ] )
QOut( [ chr(170)+chr(127)+chr(85)+chr(254) ? -->] )
? [ charnot(chr(85)+chr(128)+chr(170)+chr(1)) == ]
? [ chr(170)+chr(127)+chr(85)+chr(254) ? -->]
QOut( [ ] )
? [ ]
cStr := charnot( Chr( 85 ) + Chr( 128 ) + Chr( 170 ) + Chr( 1 ) )
for ni := 1 TO Len( cStr )
QQOut( "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")" )
Q? "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")"
IF ni < Len( cStr )
QQOut( "+" )
Q? "+"
ENDIF
next ni
QOut( "" )
?
QOut( [ charnot(charnot("This is a test!")) == "This is a test!" ?] )
QOut( [ --> "] + charnot( charnot("This is a test!" ) ) + ["] )
QOut( "" )
? [ charnot(charnot("This is a test!")) == "This is a test!" ?]
? [ --> "] + charnot( charnot("This is a test!" ) ) + ["]
?
QOut( "End test of CHARNOT()" )
QOut( "" )
? "End test of CHARNOT()"
?
ctexit()

View File

@@ -58,16 +58,16 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARODD()" )
QOut( "" )
? "Begin test of CHARODD()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charodd("1A2B3C4D5E") == "12345" ? --> "] + charodd( "1A2B3C4D5E" ) + ["] )
QOut( [ charodd("1A2B3C4D5") == "12345" ? --> "] + charodd( "1A2B3C4D5" ) + ["] )
? "Simple tests:"
? [ charodd("1A2B3C4D5E") == "12345" ? --> "] + charodd( "1A2B3C4D5E" ) + ["]
? [ charodd("1A2B3C4D5") == "12345" ? --> "] + charodd( "1A2B3C4D5" ) + ["]
QOut( "End test of CHARODD()" )
QOut( "" )
? "End test of CHARODD()"
?
ctexit()

View File

@@ -58,20 +58,20 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARONE()" )
QOut( "" )
? "Begin test of CHARONE()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charone("112333a123") == "123a123"? --> "] + charone( "112333a123" ) + ["] )
QOut( [ charone("122333a123") == "123a123"? --> "] + charone( "122333a123" ) + ["] )
QOut( [ charone("A B CCCD") == "A B CD"? ---> "] + charone( "A B CCCD" ) + ["] )
QOut( [ charone(" ", "A B A B") == "A B A B"? --> "] + charone( " ", "A B A B" ) + ["] )
QOut( [ charone("o", "122oooB12o") == "122oB12o"? -> "] + charone( "o", "122oooB12o" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charone("112333a123") == "123a123"? --> "] + charone( "112333a123" ) + ["]
? [ charone("122333a123") == "123a123"? --> "] + charone( "122333a123" ) + ["]
? [ charone("A B CCCD") == "A B CD"? ---> "] + charone( "A B CCCD" ) + ["]
? [ charone(" ", "A B A B") == "A B A B"? --> "] + charone( " ", "A B A B" ) + ["]
? [ charone("o", "122oooB12o") == "122oB12o"? -> "] + charone( "o", "122oooB12o" ) + ["]
?
QOut( "End test of CHARONE()" )
QOut( "" )
? "End test of CHARONE()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARONLY()" )
QOut( "" )
? "Begin test of CHARONLY()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charonly("0123456789", "0211 - 38 99 77") == "0211389977" ? --> "] + charonly( "0123456789", "0211 - 38 99 77" ) + ["] )
QOut( [ charonly("0123456789", "0211/ 389 977") == "0211389977" ? --> "] + charonly( "0123456789", "0211/ 389 977" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charonly("0123456789", "0211 - 38 99 77") == "0211389977" ? --> "] + charonly( "0123456789", "0211 - 38 99 77" ) + ["]
? [ charonly("0123456789", "0211/ 389 977") == "0211389977" ? --> "] + charonly( "0123456789", "0211/ 389 977" ) + ["]
?
QOut( "End test of CHARONLY()" )
QOut( "" )
? "End test of CHARONLY()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHAROR()" )
QOut( "" )
? "Begin test of CHAROR()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ charor("012345678", chr(1)) == "113355779" ? --> "] + charor( "012345678", Chr(1 ) ) + ["] )
QOut( [ charor("012345678", chr(1)+chr(3)) == "133357779" ? --> "] + charor( "012345678", Chr(1 ) + Chr(3 ) ) + ["] )
? [ charor("012345678", chr(1)) == "113355779" ? --> "] + charor( "012345678", Chr(1 ) ) + ["]
? [ charor("012345678", chr(1)+chr(3)) == "133357779" ? --> "] + charor( "012345678", Chr(1 ) + Chr(3 ) ) + ["]
QOut( "End test of CHAROR()" )
QOut( "" )
? "End test of CHAROR()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARREM()" )
QOut( "" )
? "Begin test of CHARREM()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charrem(" ", " 1 2 ") == "12" ? ---> "] + charrem( " ", " 1 2 " ) + ["] )
QOut( [ charrem("3y", "xyz123") == "xz12" ? ---> "] + charrem( "3y", "xyz123" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charrem(" ", " 1 2 ") == "12" ? ---> "] + charrem( " ", " 1 2 " ) + ["]
? [ charrem("3y", "xyz123") == "xz12" ? ---> "] + charrem( "3y", "xyz123" ) + ["]
?
QOut( "End test of CHARREM()" )
QOut( "" )
? "End test of CHARREM()"
?
ctexit()

View File

@@ -58,20 +58,20 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARREPL()" )
QOut( "" )
? "Begin test of CHARREPL()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charrepl("1234", "1x2y3z", "abcd") == "axbycz" ? --> "] + charrepl( "1234", "1x2y3z", "abcd" ) + ["] )
QOut( [ charrepl("abcdefghij", "jhfdb", "1234567890") == "08642" ? --> "] + charrepl( "abcdefghij", "jhfdb", "1234567890" ) + ["] )
QOut( [ charrepl("abcdefghij", "jhfdb", "12345") == "55542" ? --> "] + charrepl( "abcdefghij", "jhfdb", "12345" ) + ["] )
QOut( [ charrepl("1234", "1234", "234A") == "AAAA" ? --> "] + charrepl( "1234", "1234", "234A" ) + ["] )
QOut( [ charrepl("1234", "1234", "234A", .T.) == "234A" ? --> "] + charrepl( "1234", "1234", "234A", .T. ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charrepl("1234", "1x2y3z", "abcd") == "axbycz" ? --> "] + charrepl( "1234", "1x2y3z", "abcd" ) + ["]
? [ charrepl("abcdefghij", "jhfdb", "1234567890") == "08642" ? --> "] + charrepl( "abcdefghij", "jhfdb", "1234567890" ) + ["]
? [ charrepl("abcdefghij", "jhfdb", "12345") == "55542" ? --> "] + charrepl( "abcdefghij", "jhfdb", "12345" ) + ["]
? [ charrepl("1234", "1234", "234A") == "AAAA" ? --> "] + charrepl( "1234", "1234", "234A" ) + ["]
? [ charrepl("1234", "1234", "234A", .T.) == "234A" ? --> "] + charrepl( "1234", "1234", "234A", .T. ) + ["]
?
QOut( "End test of CHARREPL()" )
QOut( "" )
? "End test of CHARREPL()"
?
ctexit()

View File

@@ -60,27 +60,27 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARRLL()" )
QOut( "" )
? "Begin test of CHARRLL()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charrll(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+] )
QOut( [ chr(64)+chr(128), 3) == ] )
QOut( [ chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4) ? -->] )
? "Simple tests:"
? [ charrll(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+]
? [ chr(64)+chr(128), 3) == ]
? [ chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4) ? -->]
QOut( [ ] )
? [ ]
cStr := charrll( Chr( 1 ) + Chr( 2 ) + Chr( 4 ) + Chr( 8 ) + Chr( 16 ) + Chr( 32 ) + Chr( 64 ) + Chr( 128 ), 3 )
for ni := 1 TO Len( cStr )
QQOut( "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")" )
Q? "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")"
IF ni < Len( cStr )
QQOut( "+" )
Q? "+"
ENDIF
next ni
QOut( "" )
?
QOut( "End test of CHARRLL()" )
QOut( "" )
? "End test of CHARRLL()"
?
ctexit()

View File

@@ -60,27 +60,27 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARRLR()" )
QOut( "" )
? "Begin test of CHARRLR()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charrlr(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+] )
QOut( [ chr(64)+chr(128), 3) == ] )
QOut( [ chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16) ? -->] )
? "Simple tests:"
? [ charrlr(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+]
? [ chr(64)+chr(128), 3) == ]
? [ chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16) ? -->]
QOut( [ ] )
? [ ]
cStr := charrlr( Chr( 1 ) + Chr( 2 ) + Chr( 4 ) + Chr( 8 ) + Chr( 16 ) + Chr( 32 ) + Chr( 64 ) + Chr( 128 ), 3 )
for ni := 1 TO Len( cStr )
QQOut( "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")" )
Q? "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")"
IF ni < Len( cStr )
QQOut( "+" )
Q? "+"
ENDIF
next ni
QOut( "" )
?
QOut( "End test of CHARRLR()" )
QOut( "" )
? "End test of CHARRLR()"
?
ctexit()

View File

@@ -60,27 +60,27 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSHL()" )
QOut( "" )
? "Begin test of CHARSHL()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charshl(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+] )
QOut( [ chr(64)+chr(128), 3) == ] )
QOut( [ chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0) ? -->] )
? "Simple tests:"
? [ charshl(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+]
? [ chr(64)+chr(128), 3) == ]
? [ chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0) ? -->]
QOut( [ ] )
? [ ]
cStr := charshl( Chr( 1 ) + Chr( 2 ) + Chr( 4 ) + Chr( 8 ) + Chr( 16 ) + Chr( 32 ) + Chr( 64 ) + Chr( 128 ), 3 )
for ni := 1 TO Len( cStr )
QQOut( "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")" )
Q? "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")"
IF ni < Len( cStr )
QQOut( "+" )
Q? "+"
ENDIF
next ni
QOut( "" )
?
QOut( "End test of CHARSHL()" )
QOut( "" )
? "End test of CHARSHL()"
?
ctexit()

View File

@@ -60,27 +60,27 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSHR()" )
QOut( "" )
? "Begin test of CHARSHR()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charshr(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+] )
QOut( [ chr(64)+chr(128), 3) == ] )
QOut( [ chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16) ? -->] )
? "Simple tests:"
? [ charshr(chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+]
? [ chr(64)+chr(128), 3) == ]
? [ chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16) ? -->]
QOut( [ ] )
? [ ]
cStr := charshr( Chr( 1 ) + Chr( 2 ) + Chr( 4 ) + Chr( 8 ) + Chr( 16 ) + Chr( 32 ) + Chr( 64 ) + Chr( 128 ), 3 )
for ni := 1 TO Len( cStr )
QQOut( "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")" )
Q? "chr(" + AllTrim( Str(Asc(SubStr(cStr, ni, 1 ) ) ) ) + ")"
IF ni < Len( cStr )
QQOut( "+" )
Q? "+"
ENDIF
next ni
QOut( "" )
?
QOut( "End test of CHARSHR()" )
QOut( "" )
? "End test of CHARSHR()"
?
ctexit()

View File

@@ -58,16 +58,16 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSLIST()" )
QOut( "" )
? "Begin test of CHARSLIST()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charslist("Hello World !") == " !HWdelor" ? -> "] + charslist( "Hello World !" ) + ["] )
QOut( [ charslist(nil) == "" ? -> "] + charslist( nil ) + ["] )
? "Simple tests:"
? [ charslist("Hello World !") == " !HWdelor" ? -> "] + charslist( "Hello World !" ) + ["]
? [ charslist(nil) == "" ? -> "] + charslist( nil ) + ["]
QOut( "End test of CHARSLIST()" )
QOut( "" )
? "End test of CHARSLIST()"
?
ctexit()

View File

@@ -58,24 +58,24 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSORT()" )
QOut( "" )
? "Begin test of CHARSORT()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charsort("qwert") == "eqrtw" ? --> "] + charsort( "qwert" ) + ["] )
QOut( [ charsort("qwert", 2) == "erqwt" ? --> "] + charsort( "qwert", 2 ) + ["] )
QOut( [ charsort("b1a4a3a2a1", 2, 1) == "a2a1a3a4b1" ? --> "] + charsort( "b1a4a3a2a1", 2, 1 ) + ["] )
QOut( [ NOTE : The order of equal elements(here the one beginning with the same char) is NOT determined !] )
QOut( [ charsort("XXXqwert", 1, 1, 3) == "XXXeqrtw" ? --> "] + charsort( "XXXqwert", 1, 1, 3 ) + ["] )
QOut( [ charsort("b1a4a3a2a1", 2, 1, 0, 1) == "a1b1a2a3a4" ? --> "] + charsort( "b1a4a3a2a1", 2, 1, 0, 1 ) + ["] )
QOut( [ NOTE : The order of equal elements(here the one ending with the same number) is NOT determined !] )
QOut( [ charsort("384172852", 1, 1, 0, 0, 4) == "134872852" ? --> "] + charsort( "384172852", 1, 1, 0, 0, 4 ) + ["] )
QOut( [ charsort("qwert",,,,,,.T.) == "wtrqe" ? --> "] + charsort( "qwert",,,,,, .T. ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charsort("qwert") == "eqrtw" ? --> "] + charsort( "qwert" ) + ["]
? [ charsort("qwert", 2) == "erqwt" ? --> "] + charsort( "qwert", 2 ) + ["]
? [ charsort("b1a4a3a2a1", 2, 1) == "a2a1a3a4b1" ? --> "] + charsort( "b1a4a3a2a1", 2, 1 ) + ["]
? [ NOTE : The order of equal elements(here the one beginning with the same char) is NOT determined !]
? [ charsort("XXXqwert", 1, 1, 3) == "XXXeqrtw" ? --> "] + charsort( "XXXqwert", 1, 1, 3 ) + ["]
? [ charsort("b1a4a3a2a1", 2, 1, 0, 1) == "a1b1a2a3a4" ? --> "] + charsort( "b1a4a3a2a1", 2, 1, 0, 1 ) + ["]
? [ NOTE : The order of equal elements(here the one ending with the same number) is NOT determined !]
? [ charsort("384172852", 1, 1, 0, 0, 4) == "134872852" ? --> "] + charsort( "384172852", 1, 1, 0, 0, 4 ) + ["]
? [ charsort("qwert",,,,,,.T.) == "wtrqe" ? --> "] + charsort( "qwert",,,,,, .T. ) + ["]
?
QOut( "End test of CHARSORT()" )
QOut( "" )
? "End test of CHARSORT()"
?
ctexit()

View File

@@ -58,18 +58,18 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSUB()" )
QOut( "" )
? "Begin test of CHARSUB()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charadd("123456789", chr(1)) == "012345678" ? -> "] + charsub( "123456789", Chr(1 ) ) + ["] )
QOut( [ charadd("123456789", chr(1)+chr(2)) == "002244668" ? -> "] + charsub( "123456789", Chr(1 ) + Chr(2 ) ) + ["] )
QOut( [ charadd("012345678", chr(255)) == "123456789" ? -> "] + charsub( "012345678", Chr(255 ) ) + ["] )
QOut( [ charadd("012345678", chr(255)+chr(254)) == "133557799" ? -> "] + charsub( "012345678", Chr(255 ) + Chr(254 ) ) + ["] )
? "Simple tests:"
? [ charadd("123456789", chr(1)) == "012345678" ? -> "] + charsub( "123456789", Chr(1 ) ) + ["]
? [ charadd("123456789", chr(1)+chr(2)) == "002244668" ? -> "] + charsub( "123456789", Chr(1 ) + Chr(2 ) ) + ["]
? [ charadd("012345678", chr(255)) == "123456789" ? -> "] + charsub( "012345678", Chr(255 ) ) + ["]
? [ charadd("012345678", chr(255)+chr(254)) == "133557799" ? -> "] + charsub( "012345678", Chr(255 ) + Chr(254 ) ) + ["]
QOut( "End test of CHARSUB()" )
QOut( "" )
? "End test of CHARSUB()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARSWAP()" )
QOut( "" )
? "Begin test of CHARSWAP()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charswap("0123456789") == "1032547698" ? --> "] + charswap( "0123456789" ) + ["] )
QOut( [ charswap("ABCDEFGHIJK") == "BADCFEHGJIK" ? --> "] + charswap( "ABCDEFGHIJK" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ charswap("0123456789") == "1032547698" ? --> "] + charswap( "0123456789" ) + ["]
? [ charswap("ABCDEFGHIJK") == "BADCFEHGJIK" ? --> "] + charswap( "ABCDEFGHIJK" ) + ["]
?
QOut( "End test of CHARSWAP()" )
QOut( "" )
? "End test of CHARSWAP()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CHARXOR()" )
QOut( "" )
? "Begin test of CHARXOR()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ charxor(charxor("This is top secret !", "My Password"),] )
QOut( [ "My Password") == "This is top secret !" ? ->] )
QOut( [ ] + charxor( charxor("This is top secret !", "My Password" ),"My Password" ) )
? "Simple tests:"
? [ charxor(charxor("This is top secret !", "My Password"),]
? [ "My Password") == "This is top secret !" ? ->]
? [ ] + charxor( charxor("This is top secret !", "My Password" ),"My Password" )
QOut( "End test of CHARXOR()" )
QOut( "" )
? "End test of CHARXOR()"
?
ctexit()

View File

@@ -61,137 +61,137 @@ PROCEDURE main
ctinit()
QOut( "Begin test of CSETARGERR()" )
QOut( "" )
? "Begin test of CSETARGERR()"
?
QOut( "" )
QOut( "Local error handler: " )
?
? "Local error handler: "
olderr := ErrorBlock( {| oerr | myerrhandler( oerr ) } )
// standard behaviour on argument error
QOut( "" )
QOut( "Standard behaviour" )
QOut( " Call to addascii(5789676,1,2,.T.):" )
?
? "Standard behaviour"
? " Call to addascii(5789676,1,2,.T.):"
cRet := addascii( 5789676, 1, 2, .T. )
QOut( " return value was", cRet )
QOut( "" )
QOut( " Call to charadd('AA',.F.):" )
? " return value was", cRet
?
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_WHOCARES on argument error
QOut( "" )
QOut( "CT_ARGERR_WHOCARES behaviour" )
?
? "CT_ARGERR_WHOCARES behaviour"
CSETARGERR( CT_ARGERR_WHOCARES )
QOut( " Call to addascii(5789676,1,2,.T.):" )
? " Call to addascii(5789676,1,2,.T.):"
cRet := addascii( 5789676, 1, 2, .T. )
QOut( " return value was", cRet )
QOut( "" )
QOut( " Call to charadd('AA',.F.):" )
? " return value was", cRet
?
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_WARNING on argument error
QOut( "" )
QOut( "CT_ARGERR_WARNING behaviour" )
?
? "CT_ARGERR_WARNING behaviour"
CSETARGERR( CT_ARGERR_WARNING )
QOut( " Call to addascii(5789676,1,2,.T.):" )
? " Call to addascii(5789676,1,2,.T.):"
cRet := addascii( 5789676, 1, 2, .T. )
QOut( " return value was", cRet )
QOut( "" )
QOut( " Call to charadd('AA',.F.):" )
? " return value was", cRet
?
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_ERROR on argument error
QOut( "" )
QOut( "CT_ARGERR_ERROR behaviour" )
?
? "CT_ARGERR_ERROR behaviour"
CSETARGERR( CT_ARGERR_ERROR )
QOut( " Call to addascii(5789676,1,2,.T.):" )
? " Call to addascii(5789676,1,2,.T.):"
cRet := addascii( 5789676, 1, 2, .T. )
QOut( " return value was", cRet )
QOut( "" )
QOut( " Call to charadd('AA',.F.):" )
? " return value was", cRet
?
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_CATASTROPHIC on argument error
QOut( "" )
QOut( "CT_ARGERR_CATASTROPHIC behaviour" )
?
? "CT_ARGERR_CATASTROPHIC behaviour"
CSETARGERR( CT_ARGERR_CATASTROPHIC )
QOut( " Call to addascii(5789676,1,2,.T.):" )
? " Call to addascii(5789676,1,2,.T.):"
cRet := addascii( 5789676, 1, 2, .T. )
QOut( " return value was", cRet )
QOut( "" )
QOut( " Call to charadd('AA',.F.):" )
? " return value was", cRet
?
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
QOut( "" )
QOut( "Standard error handler: " )
?
? "Standard error handler: "
ErrorBlock( olderr )
// standard behaviour on argument error
QOut( "" )
QOut( "Standard behaviour" )
QOut( " Call to charadd('AA',.F.):" )
?
? "Standard behaviour"
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_WHOCARES on argument error
QOut( "" )
QOut( "CT_ARGERR_WHOCARES behaviour" )
?
? "CT_ARGERR_WHOCARES behaviour"
CSETARGERR( CT_ARGERR_WHOCARES )
QOut( " Call to charadd('AA',.F.):" )
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_WARNING on argument error
QOut( "" )
QOut( "CT_ARGERR_WARNING behaviour" )
?
? "CT_ARGERR_WARNING behaviour"
CSETARGERR( CT_ARGERR_WARNING )
QOut( " Call to charadd('AA',.F.):" )
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_ERROR on argument error
QOut( "" )
QOut( "CT_ARGERR_ERROR behaviour" )
?
? "CT_ARGERR_ERROR behaviour"
CSETARGERR( CT_ARGERR_ERROR )
QOut( " Call to charadd('AA',.F.):" )
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
// CT_ARGERR_CATASTROPHIC on argument error
QOut( "" )
QOut( "CT_ARGERR_CATASTROPHIC behaviour" )
?
? "CT_ARGERR_CATASTROPHIC behaviour"
CSETARGERR( CT_ARGERR_CATASTROPHIC )
QOut( " Call to charadd('AA',.F.):" )
? " Call to charadd('AA',.F.):"
cRet := charadd( "AA", .F. )
QOut( " return value was", cRet, "<Press any key>" )
QOut( "" )
? " return value was", cRet, "<Press any key>"
?
Inkey( 0 )
QOut( "End test of CSETARGERR()" )
? "End test of CSETARGERR()"
ctexit()
@@ -203,81 +203,81 @@ FUNCTION myerrhandler( oerr )
MEMVAR INPUT
QOut( " Error handler called:" )
QOut( " err:severity.....:", oerr:severity )
QOut( " err:subSystem....:", oerr:subSystem )
QOut( " err:operation....:", oerr:operation )
QOut( " len(err:args)....:", Len( oerr:args ) )
? " Error handler called:"
? " err:severity.....:", oerr:severity
? " err:subSystem....:", oerr:subSystem
? " err:operation....:", oerr:operation
? " len(err:args)....:", Len( oerr:args )
FOR ni := 1 TO Len( oerr:args )
QOut( " err:args[" + hb_ntos( ni ) + "]..:", oerr:args[ ni ] )
? " err:args[" + hb_ntos( ni ) + "]..:", oerr:args[ ni ]
NEXT
QOut( " err:genCode......:", oerr:genCode )
QOut( " err:subCode......:", oerr:subCode )
QOut( " err:osCode.......:", oerr:osCode )
QOut( " err:filename.....:", oerr:filename )
QOut( " err:tries........:", oerr:tries )
QOut( " err:cargo........:", oerr:cargo )
QOut( " err:canDefault...:", oerr:canDefault )
QOut( " err:canRetry.....:", oerr:canRetry )
QOut( " err:canSubstitute:", oerr:canSubstitute )
QOut()
? " err:genCode......:", oerr:genCode
? " err:subCode......:", oerr:subCode
? " err:osCode.......:", oerr:osCode
? " err:filename.....:", oerr:filename
? " err:tries........:", oerr:tries
? " err:cargo........:", oerr:cargo
? " err:canDefault...:", oerr:canDefault
? " err:canRetry.....:", oerr:canRetry
? " err:canSubstitute:", oerr:canSubstitute
?
IF oerr:canSubstitute
PRIVATE Input := ""
QOut( " Error handler can substitute return value, so please" )
? " Error handler can substitute return value, so please"
ACCEPT " type in return value <Return for default>: " TO Input
IF Empty( Input )
QOut( " You have chosen the default return value. Ok, this should " )
QOut( " be now problem, since the last digit of err:subCode indicates" )
QOut( " the type of the return value:" )
QOut( " 0 is NIL, 1 is String, 2 is Integer," )
QOut( " 3 is Float, 4 is Boolean, 5 is Date" )
QOut( " 6 is Block, 7 is Array, 8 is Object" )
QOut( " 9 is unknown" )
? " You have chosen the default return value. Ok, this should "
? " be now problem, since the last digit of err:subCode indicates"
? " the type of the return value:"
? " 0 is NIL, 1 is String, 2 is Integer,"
? " 3 is Float, 4 is Boolean, 5 is Date"
? " 6 is Block, 7 is Array, 8 is Object"
? " 9 is unknown"
nDigit := Int( oerr:subCode % 10 )
QOut( " Here it's a " + AllTrim( Str( nDigit ) ) + ", so I return a " )
? " Here it's a " + AllTrim( Str( nDigit ) ) + ", so I return a "
DO CASE
CASE nDigit == 0
QQOut( "NIL." )
Q? "NIL."
Input := NIL
CASE nDigit == 1
QQOut( "String." )
Q? "String."
Input := ""
CASE nDigit == 2
QQOut( "Integer." )
Q? "Integer."
Input := 0
CASE nDigit == 3
QQOut( "Float." )
Q? "Float."
Input := 0.0
CASE nDigit == 4
QQOut( "Boolean." )
Q? "Boolean."
Input := .F.
CASE nDigit == 5
QQOut( "Date." )
Q? "Date."
Input := CToD( "" )
CASE nDigit == 6
QQOut( "Block." )
Q? "Block."
Input := {|| NIL }
CASE nDigit == 7
QQOut( "Array." )
Q? "Array."
Input := {}
CASE nDigit == 8
QQOut( "Object." )
Q? "Object."
Input := GetNew()
CASE nDigit == 9
QQOut( "<don't know, NIL would be best." )
Q? "<don't know, NIL would be best."
Input := NIL
ENDCASE
@@ -289,8 +289,8 @@ FUNCTION myerrhandler( oerr )
ENDIF
IF oerr:canDefault
QOut( " Subsystem can set the default value itself, so this error" )
QOut( " is only informative." )
? " Subsystem can set the default value itself, so this error"
? " is only informative."
ENDIF
RETURN .F.

View File

@@ -58,13 +58,13 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CSETATMUPA()" )
QOut( " Default switch should be .F., is..................................", csetatmupa() )
QOut( " Setting switch to .T., return value should be .F., is.............", csetatmupa( .T. ) )
QOut( " Switch setting should now be .T., is..............................", csetatmupa() )
QOut( " Setting switch to .F. again, return value should still be .T., is ", csetatmupa( .F. ) )
QOut( "End test of CSETATMUPA()" )
QOut( "" )
? "Begin test of CSETATMUPA()"
? " Default switch should be .F., is..................................", csetatmupa()
? " Setting switch to .T., return value should be .F., is.............", csetatmupa( .T. )
? " Switch setting should now be .T., is..............................", csetatmupa()
? " Setting switch to .F. again, return value should still be .T., is ", csetatmupa( .F. )
? "End test of CSETATMUPA()"
?
ctexit()

View File

@@ -58,13 +58,13 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of CSETREF()" )
QOut( " Default switch should be .F., is..................................", csetref() )
QOut( " Setting switch to .T., return value should be .F., is.............", csetref( .T. ) )
QOut( " Switch setting should now be .T., is..............................", csetref() )
QOut( " Setting switch to .F. again, return value should still be .T., is ", csetref( .F. ) )
QOut( "End test of CSETREF()" )
QOut( "" )
? "Begin test of CSETREF()"
? " Default switch should be .F., is..................................", csetref()
? " Setting switch to .T., return value should be .F., is.............", csetref( .T. )
? " Switch setting should now be .T., is..............................", csetref()
? " Setting switch to .F. again, return value should still be .T., is ", csetref( .F. )
? "End test of CSETREF()"
?
ctexit()

View File

@@ -60,27 +60,27 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of NUMTOKEN()" )
QOut( "" )
? "Begin test of NUMTOKEN()"
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ numtoken("Hello, World!") == 2 ? ------------------------------> ] + Str( numtoken("Hello, World!" ),2 ) )
QOut( [ numtoken("This is good. See you! How do you do?",".!?") == 3 ? -> ] + Str( numtoken("This is good. See you! How do you do?",".!?" ),2 ) )
QOut( [ numtoken("one,,three,four,,six",",",1) == 6 ? -----------------> ] + Str( numtoken("one,,three,four,,six",",",1 ),2 ) )
QOut( "" )
? " Simple tests:"
? [ numtoken("Hello, World!") == 2 ? ------------------------------> ] + Str( numtoken("Hello, World!" ),2 )
? [ numtoken("This is good. See you! How do you do?",".!?") == 3 ? -> ] + Str( numtoken("This is good. See you! How do you do?",".!?" ),2 )
? [ numtoken("one,,three,four,,six",",",1) == 6 ? -----------------> ] + Str( numtoken("one,,three,four,,six",",",1 ),2 )
?
QOut( [ # of tokens in the string "] + cStr + ["] )
QOut( [ separator list = ".,!" and skip width = 1: ] + Str( numtoken(cStr, ".,!", 1 ) ) )
QOut( [ skip width = 3: ] + Str( numtoken(cStr, ".,!", 3 ) ) )
QOut( [ separator list = ",!" and skip width = 1: ] + Str( numtoken(cStr, ",!", 1 ) ) )
QOut( [ skip width = 3: ] + Str( numtoken(cStr, ",!", 3 ) ) )
QOut( [ separator list = "!" and skip width = 1: ] + Str( numtoken(cStr, "!", 1 ) ) )
QOut( [ skip width = 3: ] + Str( numtoken(cStr, "!", 3 ) ) )
? [ # of tokens in the string "] + cStr + ["]
? [ separator list = ".,!" and skip width = 1: ] + Str( numtoken(cStr, ".,!", 1 ) )
? [ skip width = 3: ] + Str( numtoken(cStr, ".,!", 3 ) )
? [ separator list = ",!" and skip width = 1: ] + Str( numtoken(cStr, ",!", 1 ) )
? [ skip width = 3: ] + Str( numtoken(cStr, ",!", 3 ) )
? [ separator list = "!" and skip width = 1: ] + Str( numtoken(cStr, "!", 1 ) )
? [ skip width = 3: ] + Str( numtoken(cStr, "!", 3 ) )
QOut( "" )
QOut( "End test of NUMTOKEN()" )
QOut()
?
? "End test of NUMTOKEN()"
?
ctexit()

View File

@@ -58,19 +58,19 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of RANGEREM()" )
QOut( "" )
? "Begin test of RANGEREM()"
?
QOut( [ rangerem("0","9","year2002.dbf") == "year.dbf" ? --> "] + ;
? [ rangerem("0","9","year2002.dbf") == "year.dbf" ? --> "] + ;
rangerem( "0", "9", "year2002.dbf" ) + ["] )
QOut( [ rangerem("9","0","year2002.dbf") == "22" ? --> "] + ;
? [ rangerem("9","0","year2002.dbf") == "22" ? --> "] + ;
rangerem( "9", "0", "year2002.dbf" ) + ["] )
QOut( [ rangerem("0","9","yearcurr.dbf") == "yearcurr.dbf" ? --> "] + ;
? [ rangerem("0","9","yearcurr.dbf") == "yearcurr.dbf" ? --> "] + ;
rangerem( "0", "9", "yearcurr.dbf" ) + ["] )
QOut( "" )
QOut( "End test of RANGEREM()" )
QOut( "" )
?
? "End test of RANGEREM()"
?
ctexit()

View File

@@ -58,19 +58,19 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of RANGEREPL()" )
QOut( "" )
? "Begin test of RANGEREPL()"
?
QOut( [ rangerepl("0","9","year2002.dbf","?") == "year????.dbf" ? --> "] + ;
? [ rangerepl("0","9","year2002.dbf","?") == "year????.dbf" ? --> "] + ;
rangerepl( "0", "9", "year2002.dbf", "?" ) + ["] )
QOut( [ rangerepl("9","0","year2002.dbf","?") == "????2??2????" ? --> "] + ;
? [ rangerepl("9","0","year2002.dbf","?") == "????2??2????" ? --> "] + ;
rangerepl( "9", "0", "year2002.dbf", "?" ) + ["] )
QOut( [ rangerepl("0","9","yearcurr.dbf","?") == "yearcurr.dbf" ? --> "] + ;
? [ rangerepl("0","9","yearcurr.dbf","?") == "yearcurr.dbf" ? --> "] + ;
rangerepl( "0", "9", "yearcurr.dbf", "?" ) + ["] )
QOut( "" )
QOut( "End test of RANGEREPL()" )
QOut( "" )
?
? "End test of RANGEREPL()"
?
ctexit()

View File

@@ -60,20 +60,20 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of SETATLIKE()" )
QOut( " Default mode should be 0, is................................", setatlike() )
QOut( " Setting mode to 1, return value should be 0, is.............", setatlike( 1 ) )
QOut( " Mode setting should now be 1, is............................", setatlike() )
QOut( " Setting mode to 0 again, return value should still be 1, is ", setatlike( 0 ) )
QOut( "" )
? "Begin test of SETATLIKE()"
? " Default mode should be 0, is................................", setatlike()
? " Setting mode to 1, return value should be 0, is.............", setatlike( 1 )
? " Mode setting should now be 1, is............................", setatlike()
? " Setting mode to 0 again, return value should still be 1, is ", setatlike( 0 )
?
setatlike( , @cWildcard )
QOut( " Default wildcard character should be '?', is................", cWildcard )
? " Default wildcard character should be '?', is................", cWildcard
setatlike( , "#" )
setatlike( , @cWildcard )
QOut( " Setting wildcard to '#' and calling SETATLIKE(,@cWildcard)" )
QOut( " should yield '#' for cWildcard, does......................", cWildcard )
QOut( "End test of SETATLIKE()" )
QOut( "" )
? " Setting wildcard to '#' and calling SETATLIKE(,@cWildcard)"
? " should yield '#' for cWildcard, does......................", cWildcard
? "End test of SETATLIKE()"
?
ctexit()

View File

@@ -58,21 +58,21 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of STRDIFF()" )
QOut( "" )
? "Begin test of STRDIFF()"
?
// simple tests
QOut( "Simple tests:" )
? "Simple tests:"
QOut( [ strdiff("ABC", "ADC") == 3 ? -> ], strdiff( "ABC", "ADC" ) )
QOut( [ strdiff("ABC", "AEC") == 3 ? -> ], strdiff( "ABC", "AEC" ) )
QOut( [ strdiff("CBA", "ABC") == 6 ? -> ], strdiff( "CBA", "ABC" ) )
QOut( [ strdiff("ABC", "AXBC") == 1 ? -> ], strdiff( "ABC", "AXBC" ) )
QOut( [ strdiff("AXBC", "ABC") == 6 ? -> ], strdiff( "AXBC", "ABC" ) )
QOut( [ strdiff("AXBC", "ADC") == 9 ? -> ], strdiff( "AXBC", "ADC" ) )
? [ strdiff("ABC", "ADC") == 3 ? -> ], strdiff( "ABC", "ADC" )
? [ strdiff("ABC", "AEC") == 3 ? -> ], strdiff( "ABC", "AEC" )
? [ strdiff("CBA", "ABC") == 6 ? -> ], strdiff( "CBA", "ABC" )
? [ strdiff("ABC", "AXBC") == 1 ? -> ], strdiff( "ABC", "AXBC" )
? [ strdiff("AXBC", "ABC") == 6 ? -> ], strdiff( "AXBC", "ABC" )
? [ strdiff("AXBC", "ADC") == 9 ? -> ], strdiff( "AXBC", "ADC" )
QOut( "End test of STRDIFF()" )
QOut( "" )
? "End test of STRDIFF()"
?
ctexit()

View File

@@ -60,101 +60,101 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of TABEXPAND()" )
QOut( "" )
? "Begin test of TABEXPAND()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ tabexpand("-"+chr(9)+"!") == "- !" ? -> "] + tabexpand( "-" + Chr(9 ) + "!" ) + ["] )
QOut( [ tabexpand("----"+chr(9) +"!") == "---- !" ? -> "] + tabexpand( "----" + Chr(9 ) + "!" ) + ["] )
QOut( [ tabexpand("-"+chr(9)+"!",, "+") == "-+++++++!" ? -> "] + tabexpand( "-" + Chr(9 ) + "!",, "+" ) + ["] )
QOut( [ tabexpand("-"+chr(9)+ "!", 4) == "- !" ? -> "] + tabexpand( "-" + Chr(9 ) + "!", 4 ) + ["] )
QOut( [ tabexpand("----"+chr(9)+ "!", 8) == "---- !" ? -> "] + tabexpand( "----" + Chr(9 ) + "!", 8 ) + ["] )
QOut( [ tabexpand("----"+chr(9)+ "!", 8, "+") == "----++++!" ? -> "] + tabexpand( "----" + Chr(9 ) + "!", 8, "+" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ tabexpand("-"+chr(9)+"!") == "- !" ? -> "] + tabexpand( "-" + Chr(9 ) + "!" ) + ["]
? [ tabexpand("----"+chr(9) +"!") == "---- !" ? -> "] + tabexpand( "----" + Chr(9 ) + "!" ) + ["]
? [ tabexpand("-"+chr(9)+"!",, "+") == "-+++++++!" ? -> "] + tabexpand( "-" + Chr(9 ) + "!",, "+" ) + ["]
? [ tabexpand("-"+chr(9)+ "!", 4) == "- !" ? -> "] + tabexpand( "-" + Chr(9 ) + "!", 4 ) + ["]
? [ tabexpand("----"+chr(9)+ "!", 8) == "---- !" ? -> "] + tabexpand( "----" + Chr(9 ) + "!", 8 ) + ["]
? [ tabexpand("----"+chr(9)+ "!", 8, "+") == "----++++!" ? -> "] + tabexpand( "----" + Chr(9 ) + "!", 8, "+" ) + ["]
?
QOut( "Tests with newline characters: ^J == LF, ^M == CR" )
? "Tests with newline characters: ^J == LF, ^M == CR"
cStr := hb_eol()
cStr := StrTran( cStr, Chr( 10 ), "^J" )
cStr := StrTran( cStr, Chr( 13 ), "^M" )
QOut( [ hb_eol() = "] + cStr + ["] )
? [ hb_eol() = "] + cStr + ["]
cStr := tabexpand( "-" + Chr( 9 ) + "!" + hb_eol() + "----" + Chr( 9 ) + "!", , "+" )
cStr := StrTran( cStr, Chr( 10 ), "^J" )
cStr := StrTran( cStr, Chr( 13 ), "^M" )
QOut( [ tabexpand("-"+chr(9)+"!"+hb_eol()+"----"+chr(9)+ "!",, "+")] )
QOut( [ == "-+++++++!"+hb_eol()+"----++++!" ? -> "] + cStr + ["] )
? [ tabexpand("-"+chr(9)+"!"+hb_eol()+"----"+chr(9)+ "!",, "+")]
? [ == "-+++++++!"+hb_eol()+"----++++!" ? -> "] + cStr + ["]
cStr := tabexpand( "-" + Chr( 9 ) + "!$$--" + hb_eol() + "--" + Chr( 9 ) + "!", , "+", "$" )
cStr := StrTran( cStr, Chr( 10 ), "^J" )
cStr := StrTran( cStr, Chr( 13 ), "^M" )
QOut( [ tabexpand("-"+chr(9)+"!$$--"+hb_eol()+--"+chr(9)+ "!",, "+", "$")] )
? [ tabexpand("-"+chr(9)+"!$$--"+hb_eol()+--"+chr(9)+ "!",, "+", "$")]
nLen := Len( hb_eol() )
QOut( [ == "-+++++++!$$--"+hb_eol()+"] + Replicate( "-",4 - nLen ) + [++!" ? -> "] + cStr + ["] )
QOut( "" )
? [ == "-+++++++!$$--"+hb_eol()+"] + Replicate( "-",4 - nLen ) + [++!" ? -> "] + cStr + ["]
?
QOut( "Tests with tab characters:" )
QOut( [ tabexpand("-"+chr(9)+"-",,"+") == "-+++++++-" ? -> "] + tabexpand( "-" + Chr(9 ) + "-",,"+" ) + ["] )
QOut( [ tabexpand("-"+chr(9)+"-",,"+",,"-")] )
QOut( [ == "++++++++^I+++++++" ? -> "] + StrTran( tabexpand("-" + Chr(9 ) + "-",,"+",,"-" ),Chr(9 ),"^I" ) + ["] )
QOut( "" )
? "Tests with tab characters:"
? [ tabexpand("-"+chr(9)+"-",,"+") == "-+++++++-" ? -> "] + tabexpand( "-" + Chr(9 ) + "-",,"+" ) + ["]
? [ tabexpand("-"+chr(9)+"-",,"+",,"-")]
? [ == "++++++++^I+++++++" ? -> "] + StrTran( tabexpand("-" + Chr(9 ) + "-",,"+",,"-" ),Chr(9 ),"^I" ) + ["]
?
QOut( "End test of TABEXPAND()" )
QOut( "Press any key to continue with tests of TABPACK()..." )
QOut( "" )
? "End test of TABEXPAND()"
? "Press any key to continue with tests of TABPACK()..."
?
Inkey( 0 )
QOut( "Begin test of TABPACK()" )
QOut( "" )
? "Begin test of TABPACK()"
?
// simple tests
QOut( "Simple tests: ^I == tab character" )
? "Simple tests: ^I == tab character"
QOut( [ tabpack("AAAAAAA*",, "*") == "AAAAAAA*" ? -> "] + StrTran( tabpack("AAAAAAA*",, "*" ),Chr(9 ),"^I" ) + ["] )
QOut( [ tabpack("AAAAA***",, "*") == "AAAAA^I" ? -> "] + StrTran( tabpack("AAAAA***",, "*" ),Chr(9 ),"^I" ) + ["] )
QOut( [ tabpack("AAAAA*****",, "*") == "AAAAA^I**" ? -> "] + StrTran( tabpack("AAAAA*****",, "*" ),Chr(9 ),"^I" ) + ["] )
QOut( "" )
? [ tabpack("AAAAAAA*",, "*") == "AAAAAAA*" ? -> "] + StrTran( tabpack("AAAAAAA*",, "*" ),Chr(9 ),"^I" ) + ["]
? [ tabpack("AAAAA***",, "*") == "AAAAA^I" ? -> "] + StrTran( tabpack("AAAAA***",, "*" ),Chr(9 ),"^I" ) + ["]
? [ tabpack("AAAAA*****",, "*") == "AAAAA^I**" ? -> "] + StrTran( tabpack("AAAAA*****",, "*" ),Chr(9 ),"^I" ) + ["]
?
QOut( "Tests with newline characters:" )
? "Tests with newline characters:"
cStr := hb_eol()
cStr := StrTran( cStr, Chr( 10 ), "^J" )
cStr := StrTran( cStr, Chr( 13 ), "^M" )
QOut( [ hb_eol() = "] + cStr + ["] )
? [ hb_eol() = "] + cStr + ["]
cStr := "ABCD+" + hb_eol() + "++---+++++"
cStr := tabpack( cStr, 4, "+" )
cStr := StrTran( cStr, Chr( 10 ), "^J" )
cStr := StrTran( cStr, Chr( 13 ), "^M" )
cStr := StrTran( cStr, Chr( 9 ), "^I" )
QOut( [ tabpack("ABCD+" + hb_eol() + "++---+++++", 4, "+")] )
QOut( [ == "ABCD+"+hb_eol()+"++---"+chr(9)+"++" ? -> "] + cStr + ["] )
? [ tabpack("ABCD+" + hb_eol() + "++---+++++", 4, "+")]
? [ == "ABCD+"+hb_eol()+"++---"+chr(9)+"++" ? -> "] + cStr + ["]
QOut( "End test of TABPACK()" )
QOut( "" )
? "End test of TABPACK()"
?
// qout("Test with a MEMOEDITed string:")
// qout(" Now, a memoedit() will start. Please type a text, use tab characters")
// qout(" and make sure, you make use of soft and hard returns !")
// qout(" ...press any key to start the memoedit now...")
// qout("")
// inkey(0)
// cls
// dispbox(0,0,20,60)
// cStr := memoedit(, 1, 1, 9, 59,,,59)
// cls
// qout(" Now printing the expanded text using a tab length of 4 and soft CRs")
// cStr1 := tabexpand(cStr,4,"+",,,.F.)
// cStr1 := strtran(cStr, chr(141), hb_eol())
//
// for ni := 1 to mlcount(cStr1, 59, 4, .T.)
// qout(" "+str(ni)+": "+memoline(cStr1, 59,ni,4,.T.))
// next ni
//
// qout(" Now printing the expanded text using a tab length of 4 but without soft CRs")
// cStr1 := tabexpand(cStr,4,"+",,,.T.)
//
// for ni := 1 to mlcount(cStr1, 59, 4, .T.)
// qout(" "+str(ni)+": "+memoline(cStr1, 59,ni,4,.T.))
// next ni
// inkey(0)
// ? "Test with a MEMOEDITed string:"
// ? " Now, a memoedit() will start. Please type a text, use tab characters"
// ? " and make sure, you make use of soft and hard returns !"
// ? " ...press any key to start the memoedit now..."
// ?
// Inkey( 0 )
// CLS
// DispBox( 0, 0, 20, 60 )
// cStr := MemoEdit( , 1, 1, 9, 59,,, 59 )
// CLS
// ? " Now printing the expanded text using a tab length of 4 and soft CRs"
// cStr1 := tabexpand( cStr, 4, "+",,, .F. )
// cStr1 := StrTran( cStr, Chr( 141 ), hb_eol() )
//
// FOR ni := 1 TO MLCount( cStr1, 59, 4, .T. )
// ? " " + Str( ni ) + ": " + MemoLine( cStr1, 59, ni, 4, .T. )
// NEXT
//
// QOut(" Now printing the expanded text using a tab length of 4 but without soft CRs")
// cStr1 := tabexpand( cStr, 4, "+",,, .T. )
//
// FOR ni := 1 TO MLCount( cStr1, 59, 4, .T. )
// ? " " + Str( ni ) + ": " + MemoLine( cStr1, 59, ni, 4, .T. )
// NEXT
// Inkey( 0 )
ctexit()

View File

@@ -63,37 +63,37 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of TOKEN()" )
QOut( "" )
? "Begin test of TOKEN()"
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ token("Hello, World!") == "World" ? -----------> "] + token( "Hello, World!" ) + ["] )
QOut( [ token("Hello, World!",,2,1) == "" ? -----------> "] + token( "Hello, World!",,2,1 ) + ["] )
QOut( [ token("Hello, World!",",",2,1) == " World!" ? -> "] + token( "Hello, World!",",",2,1 ) + ["] )
QOut( [ token("Hello, World!"," ",2,1) == "World!" ? --> "] + token( "Hello, World!"," ",2,1 ) + ["] )
QOut( "" )
? " Simple tests:"
? [ token("Hello, World!") == "World" ? -----------> "] + token( "Hello, World!" ) + ["]
? [ token("Hello, World!",,2,1) == "" ? -----------> "] + token( "Hello, World!",,2,1 ) + ["]
? [ token("Hello, World!",",",2,1) == " World!" ? -> "] + token( "Hello, World!",",",2,1 ) + ["]
? [ token("Hello, World!"," ",2,1) == "World!" ? --> "] + token( "Hello, World!"," ",2,1 ) + ["]
?
QOut( [ Tokenizing the string "] + cStr + ["] )
QOut( [ with skip width == 1 and ".,!" as tokenizer list:] )
QOut( "" )
? [ Tokenizing the string "] + cStr + ["]
? [ with skip width == 1 and ".,!" as tokenizer list:]
?
for ni := 1 TO numtoken( cStr, ".,!", 1 )
QOut( [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 1, @cPre, @cPost ) + ;
? [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 1, @cPre, @cPost ) + ;
[") @ pos ] + Str( npos := attoken( cStr, ".,!", ni, 1 ), 3 ) + [, tokenized by "] + cPre + [" and "] + cPost + [" is ] + iif( SubStr( cStr,npos,1 ) $ ".,!", "", "not " ) + "empty" )
next ni
QOut( "" )
QOut( [ Tokenizing the string "] + cStr + ["] )
QOut( [ with skip width == 3 and ".,!" as tokenizer list:] )
QOut( "" )
?
? [ Tokenizing the string "] + cStr + ["]
? [ with skip width == 3 and ".,!" as tokenizer list:]
?
for ni := 1 TO numtoken( cStr, ".,!", 3 )
QOut( [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 3, @cPre, @cPost ) + ;
? [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 3, @cPre, @cPost ) + ;
[") @ pos ] + Str( npos := attoken( cStr, ".,!", ni, 3 ), 3 ) + [, tokenized by "] + cPre + [" and "] + cPost + [" is ] + iif( SubStr( cStr,npos,1 ) $ ".,!", "", "not " ) + "empty." )
next ni
QOut( "" )
QOut( "End test of TOKEN()" )
QOut()
?
? "End test of TOKEN()"
?
ctexit()

View File

@@ -75,105 +75,105 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of incremental tokenizer function family" )
QOut( "" )
? "Begin test of incremental tokenizer function family"
?
// Some simple tests with global token environment
QOut( [ Incremental tokenizing the string "] + cStr1 + ["] )
QOut( [ tokeninit(@cStr1, ",", 1) == .T. ? ----> ] + ltoc( tokeninit(@cStr1, ",", 1 ) ) )
QOut( [ tokennum() == 6 ? ---------------------> ] + Str( tokennum() ) )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ Incremental tokenizing the string "] + cStr1 + ["]
? [ tokeninit(@cStr1, ",", 1) == .T. ? ----> ] + ltoc( tokeninit(@cStr1, ",", 1 ) )
? [ tokennum() == 6 ? ---------------------> ] + Str( tokennum() )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
WHILE( !tokenend() )
QOut( [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["] )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["]
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
ENDDO
QOut()
QOut( [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() ) )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
?
? [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
WHILE( !tokenend() )
QOut( [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["] )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["]
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
ENDDO
QOut()
QOut( [ access tokens directly with tokennext] )
QOut( [ tokennext(@cStr1,2) == "BB" ? -------> "] + tokennext( @cStr1,2 ) + ["] )
QOut( [ tokennext(@cStr1,4) == "DDDD" ? -----> "] + tokennext( @cStr1,4 ) + ["] )
QOut()
?
? [ access tokens directly with tokennext]
? [ tokennext(@cStr1,2) == "BB" ? -------> "] + tokennext( @cStr1,2 ) + ["]
? [ tokennext(@cStr1,4) == "DDDD" ? -----> "] + tokennext( @cStr1,4 ) + ["]
?
QOut( "...Press any key..." )
QOut()
? "...Press any key..."
?
Inkey( 0 )
QOut( [ Incremental tokenizing the string "] + cStr3 + [" with the] )
QOut( [ token environment of cStr1 !] )
QOut( [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() ) )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ Incremental tokenizing the string "] + cStr3 + [" with the]
? [ token environment of cStr1 !]
? [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
WHILE( !tokenend() )
QOut( [ tokennext(@cStr3) ------------------> "] + tokennext( @cStr3 ) + ["] )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokennext(@cStr3) ------------------> "] + tokennext( @cStr3 ) + ["]
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
ENDDO
QOut()
QOut( [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() ) )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
?
? [ rewind with tokeninit() == .T. ? ------> ] + ltoc( tokeninit() )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
WHILE( !tokenend() )
QOut( [ start & end with tokenat(.F./.T.)-----> ] + Str( tokenat() ) + [ ] + Str( tokenat( .T. ) ) )
? [ start & end with tokenat(.F./.T.)-----> ] + Str( tokenat() ) + [ ] + Str( tokenat( .T. ) )
tokennext( @cStr1 )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
ENDDO
QOut()
QOut( [ access tokens directly with tokenat] )
QOut( [ tokenat(.F.,2) == 3 ? ---------------> ] + Str( tokenat( .F. ,2 ) ) )
QOut( [ tokenat(.T.,4) == 14 ? --------------> ] + Str( tokenat( .T. ,4 ) ) )
QOut()
?
? [ access tokens directly with tokenat]
? [ tokenat(.F.,2) == 3 ? ---------------> ] + Str( tokenat( .F. ,2 ) )
? [ tokenat(.T.,4) == 14 ? --------------> ] + Str( tokenat( .T. ,4 ) )
?
QOut( "...Press any key..." )
QOut()
? "...Press any key..."
?
Inkey( 0 )
QOut( [ Save global token environment with savetoken] )
? [ Save global token environment with savetoken]
cTE1 := savetoken()
QOut( [ tokeninit a different string, cStr4 := "] + cStr4 + [", with tokeninit()] )
QOut( [ tokeninit(@cStr4, ":", 1) == .T. ? ----> ] + ltoc( tokeninit(@cStr4, ":", 1 ) ) )
QOut( [ tokennum() == 5 ? ---------------------> ] + Str( tokennum() ) )
QOut( [ tokennext() == "08" ? ------------------> "] + tokennext( @cStr4 ) + ["] )
QOut( [ Now restore global token environment with resttoken and rewind it] )
? [ tokeninit a different string, cStr4 := "] + cStr4 + [", with tokeninit()]
? [ tokeninit(@cStr4, ":", 1) == .T. ? ----> ] + ltoc( tokeninit(@cStr4, ":", 1 ) )
? [ tokennum() == 5 ? ---------------------> ] + Str( tokennum() )
? [ tokennext() == "08" ? ------------------> "] + tokennext( @cStr4 ) + ["]
? [ Now restore global token environment with resttoken and rewind it]
resttoken( cTE1 )
tokeninit()
QOut( [ tokennum() == 6 ? ---------------------> ] + Str( tokennum() ) )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokennum() == 6 ? ---------------------> ] + Str( tokennum() )
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
WHILE( !tokenend() )
QOut( [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["] )
QOut( [ tokenend() ? -------------------------> ] + ltoc( tokenend() ) )
? [ tokennext(@cStr1) ------------------> "] + tokennext( @cStr1 ) + ["]
? [ tokenend() ? -------------------------> ] + ltoc( tokenend() )
ENDDO
QOut( [ Release global TE with tokenexit() ----> ] + ltoc( tokenexit() ) )
QOut()
? [ Release global TE with tokenexit() ----> ] + ltoc( tokenexit() )
?
QOut( "...Press any key..." )
QOut()
? "...Press any key..."
?
Inkey( 0 )
QOut( [ Now tokenize cStr4 := "] + cStr4 + [" and] )
QOut( [ cStr5 := "] + cStr5 + ["] )
QOut( [ and store the token environment locally to cTE1 and cTE2:] )
QOut( [ tokeninit(@cStr4, ":", 1, @cTE1) == .T. ? -> ] + ltoc( tokeninit(@cStr4, ":", 1, @cTE1 ) ) )
QOut( [ tokeninit(@cStr5, "+", 1, @cTE2) == .T. ? -> ] + ltoc( tokeninit(@cStr5, "+", 1, @cTE2 ) ) )
QOut( [ tokennum(@cTE1) == 5 ? --------------------> ] + Str( tokennum(@cTE1 ) ) )
QOut( [ tokennum(@cTE2) == 4 ? --------------------> ] + Str( tokennum(@cTE2 ) ) )
QOut( [ tokenend(@cTE1) ? ---------------------> ] + ltoc( tokenend(@cTE1 ) ) )
QOut( [ tokenend(@cTE2) ? ---------------------> ] + ltoc( tokenend(@cTE2 ) ) )
? [ Now tokenize cStr4 := "] + cStr4 + [" and]
? [ cStr5 := "] + cStr5 + ["]
? [ and store the token environment locally to cTE1 and cTE2:]
? [ tokeninit(@cStr4, ":", 1, @cTE1) == .T. ? -> ] + ltoc( tokeninit(@cStr4, ":", 1, @cTE1 ) )
? [ tokeninit(@cStr5, "+", 1, @cTE2) == .T. ? -> ] + ltoc( tokeninit(@cStr5, "+", 1, @cTE2 ) )
? [ tokennum(@cTE1) == 5 ? --------------------> ] + Str( tokennum(@cTE1 ) )
? [ tokennum(@cTE2) == 4 ? --------------------> ] + Str( tokennum(@cTE2 ) )
? [ tokenend(@cTE1) ? ---------------------> ] + ltoc( tokenend(@cTE1 ) )
? [ tokenend(@cTE2) ? ---------------------> ] + ltoc( tokenend(@cTE2 ) )
WHILE( !tokenend( @cTE1 ) .AND. !tokenend( @cTE2 ) )
QOut( [ next train at ] + tokennext( cStr4,,@cTE1 ) + ":" + tokennext( cStr5,,@cTE2 ) )
QOut( [ compiled with tokennext(cStr4,,@cTE1)+":"+tokennext(cStr5,,@cTE2)] )
QOut( [ tokenend(@cTE1) ? ---------------------> ] + ltoc( tokenend(@cTE1 ) ) )
QOut( [ tokenend(@cTE2) ? ---------------------> ] + ltoc( tokenend(@cTE2 ) ) )
? [ next train at ] + tokennext( cStr4,,@cTE1 ) + ":" + tokennext( cStr5,,@cTE2 )
? [ compiled with tokennext(cStr4,,@cTE1)+":"+tokennext(cStr5,,@cTE2)]
? [ tokenend(@cTE1) ? ---------------------> ] + ltoc( tokenend(@cTE1 ) )
? [ tokenend(@cTE2) ? ---------------------> ] + ltoc( tokenend(@cTE2 ) )
ENDDO
QOut( "" )
QOut( "End test of incremental tokenizer function family" )
QOut()
?
? "End test of incremental tokenizer function family"
?
QOut( "...Press any key..." )
QOut()
? "...Press any key..."
?
Inkey( 0 )
ctexit()

View File

@@ -60,31 +60,31 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of TOKENLOWER()" )
QOut( "" )
? "Begin test of TOKENLOWER()"
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ tokenlower("Hello, World, here I am!") == "hello, world, here i am!" ?] )
QOut( [ -> "] + tokenlower( "Hello, World, here I am!" ) + ["] )
QOut( [ tokenlower("Hello, World, here I am!",,3) == "hello, world, here I am!" ?] )
QOut( [ -> "] + tokenlower( "Hello, World, here I am!",,3 ) + ["] )
QOut( [ tokenlower("Hello, World, here I am!",",",3) == "hello, World, here I am!" ?] )
QOut( [ -> "] + tokenlower( "Hello, World, here I am!",",",3 ) + ["] )
QOut( [ tokenlower("Hello, World, here I am!"," W") == "hello, World, here i am!" ?] )
QOut( [ -> "] + tokenlower( "Hello, World, here I am!"," W" ) + ["] )
QOut( "" )
? " Simple tests:"
? [ tokenlower("Hello, World, here I am!") == "hello, world, here i am!" ?]
? [ -> "] + tokenlower( "Hello, World, here I am!" ) + ["]
? [ tokenlower("Hello, World, here I am!",,3) == "hello, world, here I am!" ?]
? [ -> "] + tokenlower( "Hello, World, here I am!",,3 ) + ["]
? [ tokenlower("Hello, World, here I am!",",",3) == "hello, World, here I am!" ?]
? [ -> "] + tokenlower( "Hello, World, here I am!",",",3 ) + ["]
? [ tokenlower("Hello, World, here I am!"," W") == "hello, World, here i am!" ?]
? [ -> "] + tokenlower( "Hello, World, here I am!"," W" ) + ["]
?
QOut( [ Lowercase the tokens in the string "] + cStr + ["] )
QOut( [ with csetref(.T.) and "@"] )
? [ Lowercase the tokens in the string "] + cStr + ["]
? [ with csetref(.T.) and "@"]
csetref( .T. )
QOut( "" )
QOut( [ --> return value of tokenlower(@cStr): ], tokenlower( @cStr ) )
QOut( [ --> cStr is now: "] + cStr + ["] )
?
? [ --> return value of tokenlower(@cStr): ], tokenlower( @cStr )
? [ --> cStr is now: "] + cStr + ["]
QOut( "" )
QOut( "End test of TOKENLOWER()" )
QOut()
?
? "End test of TOKENLOWER()"
?
ctexit()

View File

@@ -61,30 +61,30 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of TOKENSEP()" )
QOut( "" )
? "Begin test of TOKENSEP()"
?
// Some simple tests
QOut( [ Tokenizing the string "] + cStr + ["] )
QOut( [ with skip width == 1 and ".,!" as tokenizer list:] )
QOut( "" )
? [ Tokenizing the string "] + cStr + ["]
? [ with skip width == 1 and ".,!" as tokenizer list:]
?
for ni := 1 TO numtoken( cStr, ".,!", 1 )
QOut( [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 1 ) + ;
? [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 1 ) + ;
[") is tokenized by "] + tokensep( .F. ) + [" and "] + tokensep( .T. ) + ["] )
next ni
QOut( "" )
QOut( [ Tokenizing the string "] + cStr + ["] )
QOut( [ with skip width == 3 and ".,!" as tokenizer list:] )
QOut( "" )
?
? [ Tokenizing the string "] + cStr + ["]
? [ with skip width == 3 and ".,!" as tokenizer list:]
?
for ni := 1 TO numtoken( cStr, ".,!", 3 )
QOut( [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 3 ) + ;
? [ Token #] + AllTrim( Str(ni ) ) + [("] + token( cStr, ".,!", ni, 3 ) + ;
[") is tokenized by "] + tokensep( .F. ) + [" and "] + tokensep( .T. ) + ["] )
next ni
QOut( "" )
QOut( "End test of TOKENSEP()" )
QOut()
?
? "End test of TOKENSEP()"
?
ctexit()

View File

@@ -60,31 +60,31 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of TOKENUPPER()" )
QOut( "" )
? "Begin test of TOKENUPPER()"
?
// Some simple tests
QOut( " Simple tests:" )
QOut( [ tokenupper("Hello, world, here I am!") == "Hello, World, Here I Am!" ?] )
QOut( [ -> "] + tokenupper( "Hello, world, here I am!" ) + ["] )
QOut( [ tokenupper("Hello, world, here I am!",,3) == "Hello, World, Here I am!" ?] )
QOut( [ -> "] + tokenupper( "Hello, world, here I am!",,3 ) + ["] )
QOut( [ tokenupper("Hello, world, here I am!",",",3) == "Hello, world, here I am!" ?] )
QOut( [ -> "] + tokenupper( "Hello, world, here I am!",",",3 ) + ["] )
QOut( [ tokenupper("Hello, world, here I am!"," w") == "Hello, wOrld, Here I Am!" ?] )
QOut( [ -> "] + tokenupper( "Hello, world, here I am!"," w" ) + ["] )
QOut( "" )
? " Simple tests:"
? [ tokenupper("Hello, world, here I am!") == "Hello, World, Here I Am!" ?]
? [ -> "] + tokenupper( "Hello, world, here I am!" ) + ["]
? [ tokenupper("Hello, world, here I am!",,3) == "Hello, World, Here I am!" ?]
? [ -> "] + tokenupper( "Hello, world, here I am!",,3 ) + ["]
? [ tokenupper("Hello, world, here I am!",",",3) == "Hello, world, here I am!" ?]
? [ -> "] + tokenupper( "Hello, world, here I am!",",",3 ) + ["]
? [ tokenupper("Hello, world, here I am!"," w") == "Hello, wOrld, Here I Am!" ?]
? [ -> "] + tokenupper( "Hello, world, here I am!"," w" ) + ["]
?
QOut( [ Uppercase the tokens in the string "] + cStr + ["] )
QOut( [ with csetref(.T.) and "@"] )
? [ Uppercase the tokens in the string "] + cStr + ["]
? [ with csetref(.T.) and "@"]
csetref( .T. )
QOut( "" )
QOut( [ --> return value of tokenupper(@cStr): ], tokenupper( @cStr ) )
QOut( [ --> cStr is now: "] + cStr + ["] )
?
? [ --> return value of tokenupper(@cStr): ], tokenupper( @cStr )
? [ --> cStr is now: "] + cStr + ["]
QOut( "" )
QOut( "End test of TOKENUPPER()" )
QOut()
?
? "End test of TOKENUPPER()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of VALPOS()" )
QOut( "" )
? "Begin test of VALPOS()"
?
QOut( [ valpos("1234x56789") == 9 ? --> ] + Str( valpos("1234x56789" ) ) )
QOut( [ valpos("1234x56789",1) == 1 ? --> ] + Str( valpos("1234x56789",1 ) ) )
QOut( [ valpos("1234x56789",11) == 0 ? --> ] + Str( valpos("1234x56789",11 ) ) )
QOut( [ valpos("1234x56789",5) == 0 ? --> ] + Str( valpos("1234x56789",5 ) ) )
? [ valpos("1234x56789") == 9 ? --> ] + Str( valpos("1234x56789" ) )
? [ valpos("1234x56789",1) == 1 ? --> ] + Str( valpos("1234x56789",1 ) )
? [ valpos("1234x56789",11) == 0 ? --> ] + Str( valpos("1234x56789",11 ) )
? [ valpos("1234x56789",5) == 0 ? --> ] + Str( valpos("1234x56789",5 ) )
QOut( "" )
QOut( "End test of VALPOS()" )
QOut( "" )
?
? "End test of VALPOS()"
?
ctexit()

View File

@@ -58,18 +58,18 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of WORDONE()" )
QOut( "" )
? "Begin test of WORDONE()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ wordone("12ABAB12") == "12AB12" ? --> "] + wordone( "12ABAB12" ) + ["] )
QOut( [ wordone("1AAAA2") == "1AAAA2" ? --> "] + wordone( "1AAAA2" ) + ["] )
QOut( [ wordone("12", "1212ABAB") == "12ABAB" ? --> "] + wordone( "12", "1212ABAB" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ wordone("12ABAB12") == "12AB12" ? --> "] + wordone( "12ABAB12" ) + ["]
? [ wordone("1AAAA2") == "1AAAA2" ? --> "] + wordone( "1AAAA2" ) + ["]
? [ wordone("12", "1212ABAB") == "12ABAB" ? --> "] + wordone( "12", "1212ABAB" ) + ["]
?
QOut( "End test of WORDONE()" )
QOut( "" )
? "End test of WORDONE()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of WORDONLY()" )
QOut( "" )
? "Begin test of WORDONLY()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ wordonly("AABBCCDD", "XXAAYYBBZZ") == "AABB" ? --> "] + wordonly( "AABBCCDD", "XXAAYYBBZZ" ) + ["] )
QOut( [ wordonly("AABBCCDD", "XAAYYYBBZZ") == "BB" ? ----> "] + wordonly( "AABBCCDD", "XAAYYYBBZZ" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ wordonly("AABBCCDD", "XXAAYYBBZZ") == "AABB" ? --> "] + wordonly( "AABBCCDD", "XXAAYYBBZZ" ) + ["]
? [ wordonly("AABBCCDD", "XAAYYYBBZZ") == "BB" ? ----> "] + wordonly( "AABBCCDD", "XAAYYYBBZZ" ) + ["]
?
QOut( "End test of WORDONLY()" )
QOut( "" )
? "End test of WORDONLY()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of WORDREM()" )
QOut( "" )
? "Begin test of WORDREM()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ wordrem("abcd", "0ab1cd") == "0ab1" ? ----> "] + wordrem( "abcd", "0ab1cd" ) + ["] )
QOut( [ wordrem("abcd", "ab0cd1") == "0cd1" ? ----> "] + wordrem( "abcd", "ab0cd1" ) + ["] )
QOut( "" )
? "Simple tests:"
? [ wordrem("abcd", "0ab1cd") == "0ab1" ? ----> "] + wordrem( "abcd", "0ab1cd" ) + ["]
? [ wordrem("abcd", "ab0cd1") == "0cd1" ? ----> "] + wordrem( "abcd", "ab0cd1" ) + ["]
?
QOut( "End test of WORDREM()" )
QOut( "" )
? "End test of WORDREM()"
?
ctexit()

View File

@@ -58,24 +58,24 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of WORDREPL()" )
QOut( "" )
? "Begin test of WORDREPL()"
?
// simple tests
QOut( " Simple tests:" )
QOut( [ wordrepl("CC", "AABBCCDDEE", "XX") == "AABBXXDDEE"? --> "] + wordrepl( "CC", "AABBCCDDEE", "XX" ) + ["] )
QOut( [ wordrepl("aa", "1aaaa", "ba") == "1abaa" ? ------> "] + wordrepl( "aa", "1aaaa", "ba" ) + ["] )
QOut( [ wordrepl("aa", "1aaaa", "ba", .T.) == "1baba" ? ------> "] + wordrepl( "aa", "1aaaa", "ba", .T. ) + ["] )
QOut( "" )
? " Simple tests:"
? [ wordrepl("CC", "AABBCCDDEE", "XX") == "AABBXXDDEE"? --> "] + wordrepl( "CC", "AABBCCDDEE", "XX" ) + ["]
? [ wordrepl("aa", "1aaaa", "ba") == "1abaa" ? ------> "] + wordrepl( "aa", "1aaaa", "ba" ) + ["]
? [ wordrepl("aa", "1aaaa", "ba", .T.) == "1baba" ? ------> "] + wordrepl( "aa", "1aaaa", "ba", .T. ) + ["]
?
QOut( " Testing CSETATMUPA(.T.) with lMode==.T.:" )
? " Testing CSETATMUPA(.T.) with lMode==.T.:"
csetatmupa( .T. )
QOut( [ wordrepl("aa", "1aaaa", "ba") == "1abaa" ? --> "] + wordrepl( "aa", "1aaaa", "ba" ) + ["] )
QOut( [ wordrepl("aa", "1aaaa", "ba", .T.) == "1bbba" ? --> "] + wordrepl( "aa", "1aaaa", "ba", .T. ) + ["] )
QOut( "" )
? [ wordrepl("aa", "1aaaa", "ba") == "1abaa" ? --> "] + wordrepl( "aa", "1aaaa", "ba" ) + ["]
? [ wordrepl("aa", "1aaaa", "ba", .T.) == "1bbba" ? --> "] + wordrepl( "aa", "1aaaa", "ba", .T. ) + ["]
?
QOut( "End test of WORDREPL()" )
QOut( "" )
? "End test of WORDREPL()"
?
ctexit()

View File

@@ -58,17 +58,17 @@ PROCEDURE Main()
ctinit()
QOut( "Begin test of WORDSWAP()" )
QOut( "" )
? "Begin test of WORDSWAP()"
?
// simple tests
QOut( "Simple tests:" )
QOut( [ wordswap("1234567890") == "3412785690" ? --> "] + wordswap( "1234567890" ) + ["] )
QOut( [ wordswap("1234567890", .t.) == "4321876590" ? --> "] + wordswap( "1234567890", .T. ) + ["] )
QOut( "" )
? "Simple tests:"
? [ wordswap("1234567890") == "3412785690" ? --> "] + wordswap( "1234567890" ) + ["]
? [ wordswap("1234567890", .t.) == "4321876590" ? --> "] + wordswap( "1234567890", .T. ) + ["]
?
QOut( "End test of WORDSWAP()" )
QOut( "" )
? "End test of WORDSWAP()"
?
ctexit()

View File

@@ -8,31 +8,31 @@ PROCEDURE Main()
? OS(), Version()
IF ! hb_FileExists( "_tst.dbf" )
dbCreate( "_tst", { { "F1","C",1,0 } } )
dbCreate( "_tst", { { "F1", "C", 1, 0 } } )
ENDIF
IF ! hb_FileExists( "_tst2.dbf" )
dbCreate( "_tst2", { { "F1","C",1,0 } } )
dbCreate( "_tst2", { { "F1", "C", 1, 0 } } )
ENDIF
USE _tst NEW ALIAS "ONE" EXCLUSIVE
? Select(), Alias(), NetErr(), Used()
?
mkTest( .T. , "NORDD", , "TWO", .T. , .F. )
mkTest( .T. , "DBF", , "TWO", .T. , .F. )
mkTest( .T. , "DBF", "", "TWO", .T. , .F. )
mkTest( .T. , "DBF", "nofile", "TWO", .T. , .F. )
mkTest( .T. , "DBF", "_tst2", "ONE", .T. , .F. )
mkTest( .T. , "DBF", "_tst", "ONE", .T. , .F. )
mkTest( .T. , "DBF", "_tst", "TWO", .T. , .F. )
mkTest( .T., "NORDD", , "TWO", .T., .F. )
mkTest( .T., "DBF", , "TWO", .T., .F. )
mkTest( .T., "DBF", "", "TWO", .T., .F. )
mkTest( .T., "DBF", "nofile", "TWO", .T., .F. )
mkTest( .T., "DBF", "_tst2", "ONE", .T., .F. )
mkTest( .T., "DBF", "_tst", "ONE", .T., .F. )
mkTest( .T., "DBF", "_tst", "TWO", .T., .F. )
?
dbUseArea( .T. , "DBF", "_tst", "ONE", .T. , .F. )
dbUseArea( .T., "DBF", "_tst", "ONE", .T., .F. )
? Select(), Alias(), NetErr(), Used()
dbUseArea( .T. , "DBF", "_tst", "TWO", .T. , .F. )
dbUseArea( .T., "DBF", "_tst", "TWO", .T., .F. )
? Select(), Alias(), NetErr(), Used()
?
dbSelectArea( 1 )
mkTest( .F. , "NORDD", , "TWO", .T. , .F. )
mkTest( .F., "NORDD", , "TWO", .T., .F. )
?
RETURN