diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 061c31cb04..5e2aa9407a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-18 16:25 UTC+0200 Viktor Szakats (harbour syenar.net) + * tests/clsnv.prg + * tests/cursrtst.prg + * tests/foreach2.prg + * tests/testpp.prg + * tests/transtst.prg + * tests/tscmdarg.c + * more cleanups + 2012-07-18 15:52 UTC+0200 Viktor Szakats (harbour syenar.net) * tests/ainstest.prg * tests/codebloc.prg diff --git a/harbour/tests/clsnv.prg b/harbour/tests/clsnv.prg index 06dfccb71c..df55d47645 100644 --- a/harbour/tests/clsnv.prg +++ b/harbour/tests/clsnv.prg @@ -11,208 +11,239 @@ * */ -#define EOL chr(10) #xtranslate QQOUT([]) => [OUTSTD()] -#xtranslate QOUT([]) => OUTSTD(EOL)[;OUTSTD()] +#xtranslate QOUT([]) => OUTSTD(hb_eol())[;OUTSTD()] #include "hbclass.ch" -proc main() -local o:=myclass3():new(), i, cbErr +PROCEDURE Main() -? DATE(), TIME(), VERSION(), OS() -? + LOCAL o := myclass3():new(), i, cbErr -o:m1() -o:m2() -o:m3() + ? Date(), Time(), Version(), OS() + ? -return + o:m1() + o:m2() + o:m3() -create class myclass1 -hidden: + RETURN + +CREATE CLASS myclass1 + hidden: var a init "(a1)" + class var b init "(b1)" - method x -protected: + + METHOD x + protected: var c init "(c1)" class var d init "(d1)" - method y -exported: + METHOD y + exported: var e init "(e1)" class var f init "(f1)" - method z - method m1 -endclass + METHOD z + METHOD m1 -method m1 -? "Method: MYCLASS1:M1()" -? " a =>", ::a, ", should be: (a1)" -? " b =>", ::b, ", should be: (b1)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -? " execute ::x(), should be: MYCLASS1:X()" -::x() -? " execute ::y(), should be: MYCLASS3:Y()" -::y() -? " execute ::z(), should be: MYCLASS3:Z()" -::z() -return self +ENDCLASS -method x -? " Method: MYCLASS1:X()" -? " a =>", ::a, ", should be: (a1)" -? " b =>", ::b, ", should be: (b1)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self +METHOD m1 -method y -? " Method: MYCLASS1:Y()" -? " a =>", ::a, ", should be: (a1)" -? " b =>", ::b, ", should be: (b1)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + ? "Method: MYCLASS1:M1()" + ? " a =>", ::a, ", should be: (a1)" + ? " b =>", ::b, ", should be: (b1)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + ? " execute ::x(), should be: MYCLASS1:X()" + ::x() + ? " execute ::y(), should be: MYCLASS3:Y()" + ::y() + ? " execute ::z(), should be: MYCLASS3:Z()" + ::z() -method z -? " Method: MYCLASS1:Z()" -? " a =>", ::a, ", should be: (a1)" -? " b =>", ::b, ", should be: (b1)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + RETURN self +METHOD x -create class myclass2 -hidden: + ? " Method: MYCLASS1:X()" + ? " a =>", ::a, ", should be: (a1)" + ? " b =>", ::b, ", should be: (b1)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD y + + ? " Method: MYCLASS1:Y()" + ? " a =>", ::a, ", should be: (a1)" + ? " b =>", ::b, ", should be: (b1)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD z + + ? " Method: MYCLASS1:Z()" + ? " a =>", ::a, ", should be: (a1)" + ? " b =>", ::b, ", should be: (b1)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + + CREATE CLASS myclass2 + hidden: var a init "(a2)" - class var b init "(b2)" - method x -protected: + +CLASS var b init "(b2)" + + METHOD x + protected: var c init "(c2)" - class var d init "(d2)" - method y -exported: + CLASS var d init "(d2)" + METHOD y + exported: var e init "(e2)" - class var f init "(f2)" - method z - method m2 -endclass + CLASS var f init "(f2)" + METHOD z + METHOD m2 -method m2 -? "Method: MYCLASS2:M2()" -? " a =>", ::a, ", should be: (a2)" -? " b =>", ::b, ", should be: (b2)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -? " execute ::x(), should be: MYCLASS2:X()" -::x() -? " execute ::y(), should be: MYCLASS3:Y()" -::y() -? " execute ::z(), should be: MYCLASS3:Z()" -::z() -return self +ENDCLASS -method x -? " Method: MYCLASS2:X()" -? " a =>", ::a, ", should be: (a2)" -? " b =>", ::b, ", should be: (b2)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self +METHOD m2 -method y -? " Method: MYCLASS2:Y()" -? " a =>", ::a, ", should be: (a2)" -? " b =>", ::b, ", should be: (b2)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + ? "Method: MYCLASS2:M2()" + ? " a =>", ::a, ", should be: (a2)" + ? " b =>", ::b, ", should be: (b2)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + ? " execute ::x(), should be: MYCLASS2:X()" + ::x() + ? " execute ::y(), should be: MYCLASS3:Y()" + ::y() + ? " execute ::z(), should be: MYCLASS3:Z()" + ::z() -method z -? " Method: MYCLASS2:Z()" -? " a =>", ::a, ", should be: (a2)" -? " b =>", ::b, ", should be: (b2)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + RETURN self +METHOD x -create class myclass3 from myclass1, myclass2 -hidden: + ? " Method: MYCLASS2:X()" + ? " a =>", ::a, ", should be: (a2)" + ? " b =>", ::b, ", should be: (b2)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD y + + ? " Method: MYCLASS2:Y()" + ? " a =>", ::a, ", should be: (a2)" + ? " b =>", ::b, ", should be: (b2)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD z + + ? " Method: MYCLASS2:Z()" + ? " a =>", ::a, ", should be: (a2)" + ? " b =>", ::b, ", should be: (b2)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +CREATE CLASS myclass3 FROM myclass1, myclass2 + hidden: var a init "(a3)" + class var b init "(b3)" - method x -protected: + + METHOD x + protected: var c init "(c3)" class var d init "(d3)" - method y -exported: + METHOD y + exported: var e init "(e3)" class var f init "(f3)" - method z - method m3 -endclass + METHOD z + METHOD m3 -method m3 -? "Method: MYCLASS3:M3()" -? " a =>", ::a, ", should be: (a3)" -? " b =>", ::b, ", should be: (b3)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -? " execute ::x(), should be: MYCLASS3:X()" -::x() -? " execute ::y(), should be: MYCLASS3:Y()" -::y() -? " execute ::z(), should be: MYCLASS3:Z()" -::z() -return self +ENDCLASS -method x -? " Method: MYCLASS3:X()" -? " a =>", ::a, ", should be: (a3)" -? " b =>", ::b, ", should be: (b3)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self +METHOD m3 -method y -? " Method: MYCLASS3:Y()" -? " a =>", ::a, ", should be: (a3)" -? " b =>", ::b, ", should be: (b3)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + ? "Method: MYCLASS3:M3()" + ? " a =>", ::a, ", should be: (a3)" + ? " b =>", ::b, ", should be: (b3)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + ? " execute ::x(), should be: MYCLASS3:X()" + ::x() + ? " execute ::y(), should be: MYCLASS3:Y()" + ::y() + ? " execute ::z(), should be: MYCLASS3:Z()" + ::z() -method z -? " Method: MYCLASS3:Z()" -? " a =>", ::a, ", should be: (a3)" -? " b =>", ::b, ", should be: (b3)" -? " c =>", ::c, ", should be: (c3)" -? " d =>", ::d, ", should be: (d3)" -? " e =>", ::e, ", should be: (e3)" -? " f =>", ::f, ", should be: (f3)" -return self + RETURN self + +METHOD x + + ? " Method: MYCLASS3:X()" + ? " a =>", ::a, ", should be: (a3)" + ? " b =>", ::b, ", should be: (b3)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD y + + ? " Method: MYCLASS3:Y()" + ? " a =>", ::a, ", should be: (a3)" + ? " b =>", ::b, ", should be: (b3)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self + +METHOD z + + ? " Method: MYCLASS3:Z()" + ? " a =>", ::a, ", should be: (a3)" + ? " b =>", ::b, ", should be: (b3)" + ? " c =>", ::c, ", should be: (c3)" + ? " d =>", ::d, ", should be: (d3)" + ? " e =>", ::e, ", should be: (e3)" + ? " f =>", ::f, ", should be: (f3)" + + RETURN self diff --git a/harbour/tests/cursrtst.prg b/harbour/tests/cursrtst.prg index 6d5266265f..8c1f192fe6 100644 --- a/harbour/tests/cursrtst.prg +++ b/harbour/tests/cursrtst.prg @@ -2,23 +2,30 @@ * $Id$ */ -proc main -Local x -? "This lists the cursor modes, along with the expected shape" -? "Press a key after each example" -? -for x := 0 to 4 - CursTest( x ) -next -? "Note: In Windows Console mode, Special2 can not be emulated (it is 2/3 size)" +PROCEDURE main() -SetCursor(1) + LOCAL x -Proc CursTest( nCurs ) -Local aTypes := { "None", "Underline", "HalfBlock", "FullBlock", "Upper Half"} -Local aNames := { "SC_NONE", "SC_NORMAL", "SC_INSERT", "SC_SPECIAL1", "SC_SPECIAL2"} + ? "This lists the cursor modes, along with the expected shape" + ? "Press a key after each example" + ? + FOR x := 0 TO 4 + CursTest( x ) + NEXT + ? "Note: In Windows Console mode, Special2 can not be emulated (it is 2/3 size)" -SetCursor( nCurs ) -++nCurs -? Padr(aNames[nCurs],11), PadR(aTypes[nCurs],11), Str(SetCursor(),3) -Inkey(0) + SetCursor( 1 ) + + RETURN + +PROCEDURE CursTest( nCurs ) + + LOCAL aTypes := { "None", "Underline", "HalfBlock", "FullBlock", "Upper Half" } + LOCAL aNames := { "SC_NONE", "SC_NORMAL", "SC_INSERT", "SC_SPECIAL1", "SC_SPECIAL2" } + + SetCursor( nCurs ) + ++ nCurs + ? PadR( aNames[nCurs], 11 ), PadR( aTypes[nCurs], 11 ), Str( SetCursor(), 3 ) + Inkey( 0 ) + + RETURN diff --git a/harbour/tests/foreach2.prg b/harbour/tests/foreach2.prg index 0e40a08f00..3ce3b81431 100644 --- a/harbour/tests/foreach2.prg +++ b/harbour/tests/foreach2.prg @@ -18,7 +18,7 @@ proc main() local e, o ? "FOR EACH e IN myclass1()" - o:=myclass1() + o := myclass1() for each e in o ? e:__enumIndex(), "=>", e next diff --git a/harbour/tests/testpp.prg b/harbour/tests/testpp.prg index de266a5491..1ddf6e74fd 100644 --- a/harbour/tests/testpp.prg +++ b/harbour/tests/testpp.prg @@ -4,7 +4,7 @@ // Tests for stringify match markers // Preproces and compile only -PROC MAIN +PROC MAIN() LOCAL b MEMVAR a PRIVATE a @@ -90,4 +90,3 @@ _DUMB_L(a,"a",'a',["'a'"],"['a']",'["a"]',&a.1,&a,&a.,&a. ,&(a),&a[1],&a.[1],&a //? [[,,]] RETURN - diff --git a/harbour/tests/transtst.prg b/harbour/tests/transtst.prg index 5621fdeb7b..3ff146e349 100644 --- a/harbour/tests/transtst.prg +++ b/harbour/tests/transtst.prg @@ -11,297 +11,313 @@ * */ +STATIC s_stop := .F. -static s_stop := .f. +PROCEDURE Main() -proc main() -test() -return + test() -function transtest( xVal, cPict, cExpect ) -local cResult := transform( xVal, cPict ) -if !cResult == cExpect - s_stop := .t. -endif -return iif( cResult == cExpect, "[OK] ", "[ERROR] ["+cExpect+"] => ") + ; - "[" + cResult + "]" + RETURN -proc stop() -if s_stop - ? repl("*",50) - inkey(0) - s_stop := .f. -endif -return +FUNCTION transtest( xVal, cPict, cExpect ) -proc test() -local dt -? transtest( "abcd", "@9!*", "ABCD" ) -? transtest( "abcd", "@_9!*", "ABCD" ) -? transtest( "abcd", "@_9"+chr(9)+"9!9", "aBc" ) -? transtest( "abcd", "@!!!", "ABCD" ) -? transtest( "abcd", "@9", "abcd" ) -? -? transtest( 134.24, "99,999.99", " 134.24" ) -? transtest( 134.24, "@E 99,999.99", " 134,24" ) -? transtest( -134.24,"@E 99,999.99", " -134,24" ) -? transtest( 134.24, "@E99,999.99", " 134,24" ) -? transtest( -134.24, "@E99,999.99", " -134,24" ) -? -? transtest(-7, "@X 9999", " 7 DB") -? transtest(stod("19920509"), "@E", "09/05/92") -? transtest(val("3.10"),"@X", "3.10") -? transtest(0.80,".9999", ".8000" ) -? transtest(-0.80, ".9999", ".****" ) -? transtest(12345.123, "@X99", " 12345.123") -? transtest(-12345.123, "@X99", " 12345.123 DB" ) -? transtest( 123456.78, "@E", " 123456,78") -? transtest(0,"@C 9.99", "0.00") -stop() + LOCAL cResult := Transform( xVal, cPict ) + + IF !cResult == cExpect + s_stop := .T. + ENDIF + + RETURN iif( cResult == cExpect, "[OK] ", "[ERROR] [" + cExpect + "] => " ) + ; + "[" + cResult + "]" + +PROC stop() + + IF s_stop + ? repl( "*", 50 ) + Inkey( 0 ) + s_stop := .F. + ENDIF + + RETURN + +PROC test() + + LOCAL dt + + ? transtest( "abcd", "@9!*", "ABCD" ) + ? transtest( "abcd", "@_9!*", "ABCD" ) + ? transtest( "abcd", "@_9" + Chr( 9 ) + "9!9", "aBc" ) + ? transtest( "abcd", "@!!!", "ABCD" ) + ? transtest( "abcd", "@9", "abcd" ) + ? + ? transtest( 134.24, "99,999.99", " 134.24" ) + ? transtest( 134.24, "@E 99,999.99", " 134,24" ) + ? transtest( - 134.24, "@E 99,999.99", " -134,24" ) + ? transtest( 134.24, "@E99,999.99", " 134,24" ) + ? transtest( - 134.24, "@E99,999.99", " -134,24" ) + ? + ? transtest( - 7, "@X 9999", " 7 DB" ) + ? transtest( SToD( "19920509" ), "@E", "09/05/92" ) + ? transtest( Val( "3.10" ), "@X", "3.10" ) + ? transtest( 0.80, ".9999", ".8000" ) + ? transtest( - 0.80, ".9999", ".****" ) + ? transtest( 12345.123, "@X99", " 12345.123" ) + ? transtest( - 12345.123, "@X99", " 12345.123 DB" ) + ? transtest( 123456.78, "@E", " 123456,78" ) + ? transtest( 0, "@C 9.99", "0.00" ) + stop() #ifdef __HARBOUR__ -dt:=stod("19871231") -set date format to "MM:DD:YYYY" -? transtest( dt, "@E", "31:12:1987" ) -set date format to "DD:MM:YYYY" -? transtest( dt, "@E", "31:12:1987") -set date format to "YYYY:MM:DD" -? transtest( dt, "@E", "31:12:1987") -set date format to "YYYY:DD:MM" -? transtest( dt, "@E", "31:12:1987") -set date format to "YY:MM:DD" -? transtest( dt, "@E", "31:12:87") -set date format to "MM:DD:YY" -? transtest( dt, "@E", "31:12:87") -set date format to "DD:MM:YY" -? transtest( dt, "@E", "31:12:87") -set date format to "" -? transtest( dt, "@E", "<31:12.87>") -set date format to "|YY|MM|DD|" -? transtest( dt, "@E", "|31|12|87|") -set date format to "MM
YY" -? transtest( dt, "@E", "31<12>87") -stop() + dt := SToD( "19871231" ) + SET DATE FORMAT TO "MM:DD:YYYY" + ? transtest( dt, "@E", "31:12:1987" ) + SET DATE FORMAT TO "DD:MM:YYYY" + ? transtest( dt, "@E", "31:12:1987" ) + SET DATE FORMAT TO "YYYY:MM:DD" + ? transtest( dt, "@E", "31:12:1987" ) + SET DATE FORMAT TO "YYYY:DD:MM" + ? transtest( dt, "@E", "31:12:1987" ) + SET DATE FORMAT TO "YY:MM:DD" + ? transtest( dt, "@E", "31:12:87" ) + SET DATE FORMAT TO "MM:DD:YY" + ? transtest( dt, "@E", "31:12:87" ) + SET DATE FORMAT TO "DD:MM:YY" + ? transtest( dt, "@E", "31:12:87" ) + SET DATE FORMAT TO "" + ? transtest( dt, "@E", "<31:12.87>" ) + SET DATE FORMAT TO "|YY|MM|DD|" + ? transtest( dt, "@E", "|31|12|87|" ) + SET DATE FORMAT TO "MM
YY" + ? transtest( dt, "@E", "31<12>87" ) + stop() #endif -? transtest( -5, "@(Z $###,##9.99", "( 5.00)" ) -? transtest( -10, "@)Z $###,##9.99", "$ (10.00)" ) -? transtest( -20, "@Z $###,##9.99", "$ -20.00" ) -? transtest(100,"9999.", " 100.") -? transtest(1.1,"@B!99.99", "1.1 ") -? transtest(12.345,"@R 99/99", " /12") -? transtest( "1234567890", "@9", "1234567890") -? transtest( 1234567890, "@9", " 1234567890") -? transtest( 1234, "9 999", "1 234" ) -? transtest( 123.123456, "999.99.99.99", "123.12.45. " ) -? transtest( 123.123456, "$$$.$$.$$.$$", "123.12.45. " ) -? transtest( 123.123456, "***.**.**.**", "123.12.45. " ) -? transtest( 99999, "9.999", "*.***" ) -? transtest( 99, "*.***", "*.***" ) -? transtest( 12345, "9999.", "****." ) -stop() -? transtest(-12345.00, "@(", "( 12345.00)") -? transtest(-12345.00, "@)", " (12345.00)") -? transtest(-123456789.00, "@(", "(123456789.00)") -? transtest(-123456789.00, "@)", "(123456789.00)") -? transtest(-1234567890, "@(", "( 1234567890)") -? transtest(-1234567890, "@)", " (1234567890)") -? transtest(-12345, "@( [999999]", "( 12345])") -? transtest(-12345, "@) [999999]", "[(12345])") -? transtest(-12345, "@( $999999", "( 12345)") -? transtest(-12345, "@) $999999", "$(12345)") -? transtest(-12345, "@( #999999", "( 12345)") -? transtest(-12345, "@) #999999", " (12345)") -? transtest(-12345, "@( $99999", "(12345)") -? transtest(-12345, "@) $99999", "(12345)") -? transtest(-12345, "@( #99999", "(12345)") -? transtest(-12345, "@) #99999", "(12345)") -? transtest(-12345, "@( 6798^999", "(7*8^***)") -? transtest(-12345, "@( 9798^9999", "(718^2345)") -stop() -? -tofix() -return + ? transtest( - 5, "@(Z $###,##9.99", "( 5.00)" ) + ? transtest( - 10, "@)Z $###,##9.99", "$ (10.00)" ) + ? transtest( - 20, "@Z $###,##9.99", "$ -20.00" ) + ? transtest( 100, "9999.", " 100." ) + ? transtest( 1.1, "@B!99.99", "1.1 " ) + ? transtest( 12.345, "@R 99/99", " /12" ) + ? transtest( "1234567890", "@9", "1234567890" ) + ? transtest( 1234567890, "@9", " 1234567890" ) + ? transtest( 1234, "9 999", "1 234" ) + ? transtest( 123.123456, "999.99.99.99", "123.12.45. " ) + ? transtest( 123.123456, "$$$.$$.$$.$$", "123.12.45. " ) + ? transtest( 123.123456, "***.**.**.**", "123.12.45. " ) + ? transtest( 99999, "9.999", "*.***" ) + ? transtest( 99, "*.***", "*.***" ) + ? transtest( 12345, "9999.", "****." ) + stop() + ? transtest( - 12345.00, "@(", "( 12345.00)" ) + ? transtest( - 12345.00, "@)", " (12345.00)" ) + ? transtest( - 123456789.00, "@(", "(123456789.00)" ) + ? transtest( - 123456789.00, "@)", "(123456789.00)" ) + ? transtest( - 1234567890, "@(", "( 1234567890)" ) + ? transtest( - 1234567890, "@)", " (1234567890)" ) + ? transtest( - 12345, "@( [999999]", "( 12345])" ) + ? transtest( - 12345, "@) [999999]", "[(12345])" ) + ? transtest( - 12345, "@( $999999", "( 12345)" ) + ? transtest( - 12345, "@) $999999", "$(12345)" ) + ? transtest( - 12345, "@( #999999", "( 12345)" ) + ? transtest( - 12345, "@) #999999", " (12345)" ) + ? transtest( - 12345, "@( $99999", "(12345)" ) + ? transtest( - 12345, "@) $99999", "(12345)" ) + ? transtest( - 12345, "@( #99999", "(12345)" ) + ? transtest( - 12345, "@) #99999", "(12345)" ) + ? transtest( - 12345, "@( 6798^999", "(7*8^***)" ) + ? transtest( - 12345, "@( 9798^9999", "(718^2345)" ) + stop() + ? + tofix() -proc tofix() -? transtest( 134.24, "@E99,999.99", " 134,24" ) -? transtest( -134.24, "@E99,999.99", " -134,24" ) -? transtest(0.80,".9999", ".8000") -? transtest(-0.80,".9999", ".****") -? transtest(12345.123, "@X99", " 12345.123") -? transtest(-12345.123, "@X99", " 12345.123 DB") -? transtest( 123456.78, "@E", " 123456,78") -? transtest(0,"@C 9.99", "0.00") -? transtest(1.1,"@B!99.99", "1.1 ") -? transtest(-12345, "@) [999999]", "[(12345])") -? transtest(-12345, "@) $999999", "$(12345)") -? transtest(-12345, "@) *999999", "*(12345)") -? transtest(-12345, "@) #999999", " (12345)") -? transtest(-12345, "@) *9$9*999]", "*($12345])") -? transtest(-12345, "@) *999*999]", "* (12345])") -? transtest(-12345, "@) 0999*999]", "0 (12345])") -? transtest(-12345, "@) 1999*999]", "1 (12345])") -? transtest(-12345, "@) *[99*999]", "([ 12345])") -? transtest(-12345, "@) *****999]", "(**12345])") -? transtest(-12345, "@) *1***999]", "(1*12345])") -? transtest(-12345, "@) * 999999]", "* (12345])") -? transtest( -5, "@(Z $###,##9.99", "( 5.00)" ) -? transtest( -10, "@)Z $###,##9.99", "$ (10.00)" ) -? transtest( -5, "@(Z $999,999.99", "( 5.00)" ) -? transtest( -10, "@)Z $999,999.99", "$ (10.00)" ) -? transtest( -5, "@(Z 999,999.99", "( 5.00)" ) -? transtest( -10, "@)Z 999,999.99", " (10.00)" ) -? transtest( -20, "@Z $###,##9.99", "$ -20.00" ) -? transtest(0.1,".9", ".1") -? transtest(0.0,".9", ".0") -? transtest(1,".9", ".*") -? transtest(.456,".9", ".5") -? transtest(123,"99.-", "**.-") -stop() -? transtest(-123.45,"999,999.99", " -123.45") -? transtest(-123456.78,"999,999,999.99", " -123,456.78") -? transtest(-123456.78,"$$$,$$$,$$$.$$", "$$ -123,456.78") -? transtest(-123456.78,"***,***,***.**", "***-123,456.78") -? transtest(123456.78,"@E 888,$$$,$$$.$$", "888.123.456,78") -? transtest(123456.78,"@E 888x,$$$,$$$.$$", "888xx123.456,78") -? transtest(123456.78,"@E 888x,,$$$,$$$.$$", "888xxx123.456,78") -? transtest(123456.78,"@E 8,88x,,$$$,$$$.$$", "8.88xxx123.456,78") -? transtest(123456.78,"@E 8,88x,,$$$,,$$$.$$", "8.88xxx123..456,78") -? transtest(123456.78,"@E 8,88x,,$$$,,$$$.$$77,7", "8.88xxx123..456,7877,7") -? transtest(123456,"@E 8,88x,,$$$,,$$$77,7", "8.88xxx123..45677,7") -? transtest(123456,"@E -,999,999", " -123.456") -? transtest(12345,"@E -,999,999", " - 12.345") -? transtest(12345,"@E -,|999,999", " -| 12.345") -? transtest(12345,"@E ^-,|999,999", "^^-| 12.345") -? transtest(12345,"@E 1-,|999,999", "11-| 12.345") -? transtest(12345,"@E |--,|999,999", "|---| 12.345") -stop() -? transtest(12.34,"@E 99'99", " '12") -? transtest(12.34,"99,99,11", " 12,11") -? transtest(12.34,"@E 99,99,11", " 12,11") -? transtest(12.34,"@E 99,", "12,") -? transtest(12.34,"@E 9,9", "1.2") -? transtest(12.34,"@E ab,cd.ef9,9.99,.--", "abbcd,ef***,* ,.--") -? transtest(12.34,"@E ab,cd,ef9,9.99,.--", "abbcddef1.2,34,.--") -? transtest(12.34,"@E ,ab,cd,ef9,9.99,.--", ",abbcddef1.2,34,.--") -? transtest(12.34,"@E ,,,,99,.99,.--", ",,,,12.,34,.--") -? transtest(124.4,"@E ,,,,9,9.99,.--", ",,,,***,**,.--") -? transtest( 1.2,"@E ,,,,*,*.**,.--", ",,,,**1,20,.--") -? transtest(12.34,"@E ,,,,*,*.**,.--", ",,,,1.2,34,.--") -? transtest(12.34,"@E ,,,,*,*.**,.--,--", ",,,,1.2,34,.--,--") -? transtest(12.34,"@E ,,,,*,*,.,**", ",,,,1.2.,,34") -? transtest(12.34,",,,,*,*,.,**", ",,,,1,2,..34") -? transtest(12.34,",,,,*,*,.,*|,*", ",,,,1,2,..3||4") -? transtest(12.34,",,,,*,*,.,*,*", ",,,,1,2,..3,4") -? transtest(123.345678912,"@E 999.99.99,99.99.", "123,34,67.89, .") + RETURN + +PROC tofix() + + ? transtest( 134.24, "@E99,999.99", " 134,24" ) + ? transtest( - 134.24, "@E99,999.99", " -134,24" ) + ? transtest( 0.80, ".9999", ".8000" ) + ? transtest( - 0.80, ".9999", ".****" ) + ? transtest( 12345.123, "@X99", " 12345.123" ) + ? transtest( - 12345.123, "@X99", " 12345.123 DB" ) + ? transtest( 123456.78, "@E", " 123456,78" ) + ? transtest( 0, "@C 9.99", "0.00" ) + ? transtest( 1.1, "@B!99.99", "1.1 " ) + ? transtest( - 12345, "@) [999999]", "[(12345])" ) + ? transtest( - 12345, "@) $999999", "$(12345)" ) + ? transtest( - 12345, "@) *999999", "*(12345)" ) + ? transtest( - 12345, "@) #999999", " (12345)" ) + ? transtest( - 12345, "@) *9$9*999]", "*($12345])" ) + ? transtest( - 12345, "@) *999*999]", "* (12345])" ) + ? transtest( - 12345, "@) 0999*999]", "0 (12345])" ) + ? transtest( - 12345, "@) 1999*999]", "1 (12345])" ) + ? transtest( - 12345, "@) *[99*999]", "([ 12345])" ) + ? transtest( - 12345, "@) *****999]", "(**12345])" ) + ? transtest( - 12345, "@) *1***999]", "(1*12345])" ) + ? transtest( - 12345, "@) * 999999]", "* (12345])" ) + ? transtest( - 5, "@(Z $###,##9.99", "( 5.00)" ) + ? transtest( - 10, "@)Z $###,##9.99", "$ (10.00)" ) + ? transtest( - 5, "@(Z $999,999.99", "( 5.00)" ) + ? transtest( - 10, "@)Z $999,999.99", "$ (10.00)" ) + ? transtest( - 5, "@(Z 999,999.99", "( 5.00)" ) + ? transtest( - 10, "@)Z 999,999.99", " (10.00)" ) + ? transtest( - 20, "@Z $###,##9.99", "$ -20.00" ) + ? transtest( 0.1, ".9", ".1" ) + ? transtest( 0.0, ".9", ".0" ) + ? transtest( 1, ".9", ".*" ) + ? transtest( .456, ".9", ".5" ) + ? transtest( 123, "99.-", "**.-" ) + stop() + ? transtest( - 123.45, "999,999.99", " -123.45" ) + ? transtest( - 123456.78, "999,999,999.99", " -123,456.78" ) + ? transtest( - 123456.78, "$$$,$$$,$$$.$$", "$$ -123,456.78" ) + ? transtest( - 123456.78, "***,***,***.**", "***-123,456.78" ) + ? transtest( 123456.78, "@E 888,$$$,$$$.$$", "888.123.456,78" ) + ? transtest( 123456.78, "@E 888x,$$$,$$$.$$", "888xx123.456,78" ) + ? transtest( 123456.78, "@E 888x,,$$$,$$$.$$", "888xxx123.456,78" ) + ? transtest( 123456.78, "@E 8,88x,,$$$,$$$.$$", "8.88xxx123.456,78" ) + ? transtest( 123456.78, "@E 8,88x,,$$$,,$$$.$$", "8.88xxx123..456,78" ) + ? transtest( 123456.78, "@E 8,88x,,$$$,,$$$.$$77,7", "8.88xxx123..456,7877,7" ) + ? transtest( 123456, "@E 8,88x,,$$$,,$$$77,7", "8.88xxx123..45677,7" ) + ? transtest( 123456, "@E -,999,999", " -123.456" ) + ? transtest( 12345, "@E -,999,999", " - 12.345" ) + ? transtest( 12345, "@E -,|999,999", " -| 12.345" ) + ? transtest( 12345, "@E ^-,|999,999", "^^-| 12.345" ) + ? transtest( 12345, "@E 1-,|999,999", "11-| 12.345" ) + ? transtest( 12345, "@E |--,|999,999", "|---| 12.345" ) + stop() + ? transtest( 12.34, "@E 99'99", " '12" ) + ? transtest( 12.34, "99,99,11", " 12,11" ) + ? transtest( 12.34, "@E 99,99,11", " 12,11" ) + ? transtest( 12.34, "@E 99,", "12," ) + ? transtest( 12.34, "@E 9,9", "1.2" ) + ? transtest( 12.34, "@E ab,cd.ef9,9.99,.--", "abbcd,ef***,* ,.--" ) + ? transtest( 12.34, "@E ab,cd,ef9,9.99,.--", "abbcddef1.2,34,.--" ) + ? transtest( 12.34, "@E ,ab,cd,ef9,9.99,.--", ",abbcddef1.2,34,.--" ) + ? transtest( 12.34, "@E ,,,,99,.99,.--", ",,,,12.,34,.--" ) + ? transtest( 124.4, "@E ,,,,9,9.99,.--", ",,,,***,**,.--" ) + ? transtest( 1.2, "@E ,,,,*,*.**,.--", ",,,,**1,20,.--" ) + ? transtest( 12.34, "@E ,,,,*,*.**,.--", ",,,,1.2,34,.--" ) + ? transtest( 12.34, "@E ,,,,*,*.**,.--,--", ",,,,1.2,34,.--,--" ) + ? transtest( 12.34, "@E ,,,,*,*,.,**", ",,,,1.2.,,34" ) + ? transtest( 12.34, ",,,,*,*,.,**", ",,,,1,2,..34" ) + ? transtest( 12.34, ",,,,*,*,.,*|,*", ",,,,1,2,..3||4" ) + ? transtest( 12.34, ",,,,*,*,.,*,*", ",,,,1,2,..3,4" ) + ? transtest( 123.345678912, "@E 999.99.99,99.99.", "123,34,67.89, ." ) #ifdef __HARBOUR__ -? transtest( 1234567890123456789, "99999999999999999999", " 1234567890123456789" ) -? transtest( -1234567890123456789, "99999999999999999999", "-1234567890123456789" ) + ? transtest( 1234567890123456789, "99999999999999999999", " 1234567890123456789" ) + ? transtest( - 1234567890123456789, "99999999999999999999", "-1234567890123456789" ) #else -? transtest( 1234567890123456789, "99999999999999999999", " 1234567890123457000" ) -? transtest( -1234567890123456789, "99999999999999999999", "-1234567890123457000" ) + ? transtest( 1234567890123456789, "99999999999999999999", " 1234567890123457000" ) + ? transtest( - 1234567890123456789, "99999999999999999999", "-1234567890123457000" ) #endif -stop() -set(_SET_DATEFORMAT,"YYYY/MM/DD") -? transtest(12345678,"@D", "1234/56/78") -set(_SET_DATEFORMAT,"YYYY.MM.DD") -? transtest(1234.56789,"@D", "1234.56.9 ") -set(_SET_DATEFORMAT,"YYYY.MM:DD") -? transtest(1234.56789,"@D", "1234.56:79") -? transtest(123.345678912,"@D ", " 123.34:57") -set(_SET_DATEFORMAT,"MM-DD-YYYY") -? transtest(.t.,"@RE <|,yY#lL,|>", "99-99-9999T") -? transtest(.f.,"@RE <|,yY#lL,|>", "99-99-9999F") -? transtest(.t.,"@RD <|,yY#lL,|>", "99-99-9999T") -? transtest(.f.,"@RD <|,yY#lL,|>", "99-99-9999F") -? transtest(.f.,"@DE <|,yY#lL,|>", "9") -? transtest("abcdefghij","@S15! ", "") -? transtest("abcdefghij","@S0! ", "") -? transtest("abcdefghij","@S5! ", "", "99-99-9999T" ) + ? transtest( .F. , "@RE <|,yY#lL,|>", "99-99-9999F" ) + ? transtest( .T. , "@RD <|,yY#lL,|>", "99-99-9999T" ) + ? transtest( .F. , "@RD <|,yY#lL,|>", "99-99-9999F" ) + ? transtest( .F. , "@DE <|,yY#lL,|>", "9" ) + ? transtest( "abcdefghij", "@S15! ", "" ) + ? transtest( "abcdefghij", "@S0! ", "" ) + ? transtest( "abcdefghij", "@S5! ", "