diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9b353ab337..aa30ce5537 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +19991123-00:29 GMT+1 Victor Szel + * tests/regress/* + + Split rt_str into rt_str + rt_trans. + ! Typo fixed in Clipper batch file. + ! Fixed another long function name (Main_STRINGS() -> Main_STR()) + * make_b32.bat + make_b40.bat + makefile.b32 + regress.b32 + * Updates by Jose Lalin. + 19991122-23:43 GMT+1 Victor Szel * tests/regress/rt_hvm.prg tests/regress/rt_misc.prg diff --git a/harbour/make_b32.bat b/harbour/make_b32.bat index 70b2fa5eb5..f17fc489c7 100644 --- a/harbour/make_b32.bat +++ b/harbour/make_b32.bat @@ -3,8 +3,7 @@ rem rem $Id$ rem -del make.err -make -fhbpp.b32 >> make.err +make -fhbpp.b32 > make.err make -fmakefile.b32 >> make.err make -fterminal.b32 >> make.err make -fgt.b32 >> make.err diff --git a/harbour/make_b40.bat b/harbour/make_b40.bat index 82ffb04b07..40e1d3061e 100644 --- a/harbour/make_b40.bat +++ b/harbour/make_b40.bat @@ -3,7 +3,7 @@ rem rem $Id$ rem -make -DB40 -fhbpp.b32 >> make.err +make -DB40 -fhbpp.b32 > make.err make -DB40 -fmakefile.b32 >> make.err make -DB40 -fterminal.b32 >> make.err make -DB40 -fgt.b32 >> make.err diff --git a/harbour/makefile.b32 b/harbour/makefile.b32 index 57b1a382ad..c95d5e6d5b 100644 --- a/harbour/makefile.b32 +++ b/harbour/makefile.b32 @@ -35,7 +35,7 @@ harbour.lib : achoice.obj adir.obj alert.obj arrays.obj \ initsymb.obj inkey.obj input.obj isprint.obj itemapi.obj \ langapi.obj mainstd.obj mainwin.obj math.obj \ mathx.obj memofile.obj memoline.obj memvars.obj \ - memvarbl.obj menuto.obj mlcount.obj mtran.obj msges.obj \ + memvarbl.obj menuto.obj mlcount.obj mtran.obj msgen.obj \ natmsg.obj net.obj objfunc.obj oldbox.obj oldclear.obj \ readvar.obj readkey.obj \ samples.obj set.obj setta.obj setcolor.obj \ @@ -242,4 +242,4 @@ expropt.obj : expropt.c harbour.obj : harbour.c bcc32 $(BCC_OPT) -c -Iinclude;source\compiler -osource\compiler\harbour.obj \ - source\compiler\harbour.c \ No newline at end of file + source\compiler\harbour.c diff --git a/harbour/regress.b32 b/harbour/regress.b32 index cef3ceeb24..c051cac3fe 100644 --- a/harbour/regress.b32 +++ b/harbour/regress.b32 @@ -6,6 +6,7 @@ .path.h = include .path.lib = lib\b32 +.path.obj = tests\regress .path.c = tests\regress .path.prg = tests\regress @@ -19,6 +20,7 @@ rt_hvm.obj : rt_hvm.c rt_math.obj : rt_math.c rt_misc.obj : rt_misc.c rt_str.obj : rt_str.c +rt_trans.obj : rt_trans.c rt_main.c : rt_main.prg rt_array.c : rt_array.prg @@ -28,20 +30,24 @@ rt_hvm.c : rt_hvm.prg rt_math.c : rt_math.prg rt_misc.c : rt_misc.prg rt_str.c : rt_str.prg +rt_trans.c : rt_trans.prg .prg.c: - bin\harbour $< /n /iinclude + bin\harbour $< /n /otests\regress\ /iinclude .c.obj: bcc32 -c -O2 -Iinclude -v -o$@ -DHARBOUR_USE_WIN_GTAPI $< rt_main.exe : rt_main.obj rt_array.obj rt_date.obj rt_file.obj \ - rt_hvm.obj rt_math.obj rt_misc.obj rt_str.obj + rt_hvm.obj rt_math.obj rt_misc.obj rt_str.obj rt_trans.obj echo -v -O2 > temp.32 - echo -ert_main.exe >> temp.32 + echo -etests\regress\rt_main.exe >> temp.32 echo -Iinclude >> temp.32 - echo rt_main.obj rt_array.obj rt_date.obj rt_file.obj >> temp.32 - echo rt_hvm.obj rt_math.obj rt_misc.obj rt_str.obj >> temp.32 + echo tests\regress\rt_main.obj tests\regress\rt_array.obj >> temp.32 + echo tests\regress\rt_date.obj tests\regress\rt_file.obj >> temp.32 + echo tests\regress\rt_hvm.obj tests\regress\rt_math.obj >> temp.32 + echo tests\regress\rt_misc.obj tests\regress\rt_str.obj >> temp.32 + echo tests\regress\rt_trans.obj >> temp.32 echo lib\b32\harbour.lib >> temp.32 echo lib\b32\terminal.lib >> temp.32 echo lib\b32\hbpp.lib >> temp.32 diff --git a/harbour/tests/regress/Makefile b/harbour/tests/regress/Makefile index 91f1b7c987..710cad26ec 100644 --- a/harbour/tests/regress/Makefile +++ b/harbour/tests/regress/Makefile @@ -13,6 +13,7 @@ PRG_SOURCES=\ rt_math.prg \ rt_misc.prg \ rt_str.prg \ + rt_trans.prg \ PRG_MAIN=rt_main.prg diff --git a/harbour/tests/regress/make_c5x.bat b/harbour/tests/regress/make_c5x.bat index ce7eceb064..2174a0d8b9 100644 --- a/harbour/tests/regress/make_c5x.bat +++ b/harbour/tests/regress/make_c5x.bat @@ -11,9 +11,10 @@ clipper rt_hvm.prg /w /n clipper rt_math.prg /w /n clipper rt_misc.prg /w /n clipper rt_str.prg /w /n +clipper rt_trans.prg /w /n if %1.==. set _=rtlink if not %1.==. set _=exospace -%_ out rt_main fi rt_main, rt_array, rt_date, rt_file, rt_hvm, rt_math, rt_misc, rt_str +%_% out rt_main fi rt_main, rt_array, rt_date, rt_file, rt_hvm, rt_math, rt_misc, rt_str, rt_trans del *.obj diff --git a/harbour/tests/regress/rt_main.prg b/harbour/tests/regress/rt_main.prg index bf795a10c0..eb97e938b5 100644 --- a/harbour/tests/regress/rt_main.prg +++ b/harbour/tests/regress/rt_main.prg @@ -132,7 +132,8 @@ FUNCTION Main( cPar1, cPar2 ) Main_HVM() Main_MATH() Main_DATE() - Main_STRINGS() + Main_STR() + Main_TRANS() Comp_Str() Exact_Str() #ifdef __HARBOUR__ diff --git a/harbour/tests/regress/rt_str.prg b/harbour/tests/regress/rt_str.prg index b91ce18d3a..1aa76c3baa 100644 --- a/harbour/tests/regress/rt_str.prg +++ b/harbour/tests/regress/rt_str.prg @@ -137,7 +137,7 @@ INIT PROCEDURE RT_InitStatics() RETURN -FUNCTION Main_STRINGS() +FUNCTION Main_STR() /* VAL() */ @@ -868,215 +868,6 @@ FUNCTION Main_STRINGS() TEST_LINE( StrZero(-100000, 6, -1) , "******" ) TEST_LINE( StrZero(-100000, 8, -1) , "-0100000" ) - /* TRANSFORM() */ - - TEST_LINE( Transform( NIL , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( NIL , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( NIL , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {} , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {} , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {} , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( ErrorNew(), NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( ErrorNew(), "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( ErrorNew(), "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {|| NIL } , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {|| NIL } , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( {|| NIL } , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - - TEST_LINE( Transform( "", "" ) , "" ) - TEST_LINE( Transform( "", "@" ) , "" ) - TEST_LINE( Transform( "", NIL ) , "" ) - TEST_LINE( Transform( "", 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( "hello", "" ) , "hello" ) - TEST_LINE( Transform( "hello", "@" ) , "hello" ) - TEST_LINE( Transform( "hello", NIL ) , "hello" ) - TEST_LINE( Transform( "hello", 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( 100.2, "" ) , " 100.2" ) - TEST_LINE( Transform( 100.2, "@" ) , " 100.2" ) - TEST_LINE( Transform( 100.2, NIL ) , " 100.2" ) - TEST_LINE( Transform( 100.2, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( 100.20, "" ) , " 100.20" ) - TEST_LINE( Transform( 100.20, "@" ) , " 100.20" ) - TEST_LINE( Transform( 100.20, NIL ) , " 100.20" ) - TEST_LINE( Transform( 100.20, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( Val("100.2"), "" ) , "100.2" ) - TEST_LINE( Transform( Val("100.2"), "@" ) , "100.2" ) - TEST_LINE( Transform( Val("100.2"), NIL ) , "100.2" ) - TEST_LINE( Transform( Val("100.2"), 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( Val("100.20"), "" ) , "100.20" ) -// TEST_LINE( Transform( Val("100.20"), "@" ) , "100.20" ) - TEST_LINE( Transform( Val("100.20"), NIL ) , "100.20" ) - TEST_LINE( Transform( Val("100.20"), 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( sdDate, "" ) , "1980.01.01" ) - TEST_LINE( Transform( sdDate, "@" ) , "1980.01.01" ) - TEST_LINE( Transform( sdDate, NIL ) , "1980.01.01" ) - TEST_LINE( Transform( sdDate, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - TEST_LINE( Transform( .T., "" ) , "T" ) - TEST_LINE( Transform( .T., "@" ) , "T" ) - TEST_LINE( Transform( .F., NIL ) , "F" ) - TEST_LINE( Transform( .F., 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - - TEST_LINE( Transform( scStringM , "!!!!!" ) , "HELLO" ) - TEST_LINE( Transform( scStringM , "@!" ) , "HELLO" ) -#ifdef __HARBOUR__ - TEST_LINE( Transform( @scStringM, "!!!!!" ) , "HELLO" ) /* Bug in CA-Cl*pper, it returns: "E BASE 1122 Argument error TRANSFORM F:S" */ - TEST_LINE( Transform( @scStringM, "@!" ) , "HELLO" ) /* Bug in CA-Cl*pper, it returns: "E BASE 1122 Argument error TRANSFORM F:S" */ -#endif - TEST_LINE( Transform( scStringM , "" ) , "Hello" ) - TEST_LINE( Transform( scStringM , NIL ) , "Hello" ) - TEST_LINE( Transform( scStringM , 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) - - TEST_LINE( Transform("abcdef", "@! !lkm!") , "ABkmE" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! 1234567890"), "12345678I0" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyzabcdefg", "@! abcdefghijklmnopqrstuvwxyzabcdefg"), "AbcdefghijkLmNopqrstuvwXYzAbcdefg" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! `~!@#$% ^&*()_+-={}\|;':") , "`~C@E$% ^&*()_+-={}\|;':" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! ,./<>?") , ",./<>?" ) - TEST_LINE( Transform("hello", " @!") , " @L" ) - - TEST_LINE( Transform("abcdef", "@R! !lkm!") , "ABkmC" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! 1234567890"), "12345678A0" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyzabcdefg", "@R! abcdefghijklmnopqrstuvwxyzabcdefg"), "AbcdefghijkBmCopqrstuvwDNzFbcdefg" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! `~!@#$% ^&*()_+-={}\|;':") , "`~A@B$% ^&*()_+-={}\|;':" ) - TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! ,./<>?") , ",./<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) - TEST_LINE( Transform("hello", " @R!") , " @RL" ) - - TEST_LINE( Transform("abc", "@R !!!!") , "ABC " ) - TEST_LINE( Transform("abc", "@R XXXX") , "abc " ) - TEST_LINE( Transform("abc", "@R !!") , "AB" ) - TEST_LINE( Transform("abc", "@R XX") , "ab" ) - TEST_LINE( Transform("abc", "@!R !!!!") , "ABC " ) - TEST_LINE( Transform("abc", "@!R XXXX") , "ABC " ) - TEST_LINE( Transform("abc", "@!R !!") , "AB" ) - TEST_LINE( Transform("abc", "@!R XX") , "AB" ) - - TEST_LINE( Transform( "Hallo ", "!!!!!" ) , "HALLO" ) - TEST_LINE( Transform( "Hallo ", "!!A!!" ) , "HAlLO" ) - TEST_LINE( Transform( "Hallo ", "!!A9!" ) , "HAllO" ) - TEST_LINE( Transform( "Hallo ", "!QA9!" ) , "HQllO" ) - TEST_LINE( Transform( "Hallo ", "ZQA9!" ) , "ZQllO" ) - TEST_LINE( Transform( "Hall" , "ZQA9!" ) , "ZQll" ) - TEST_LINE( Transform( "Hallo ", "!AAA" ) , "Hall" ) - TEST_LINE( Transform( "Hallo ", "@!" ) , "HALLO " ) - TEST_LINE( Transform( "Hallo ", "@! AA" ) , "HA" ) - TEST_LINE( Transform( "Hallo ", "@R" ) , "Hallo " ) - TEST_LINE( Transform( "Hallo ", "@Z" ) , " " ) - TEST_LINE( Transform( "Hallo ", "@R !!" ) , "HA" ) - TEST_LINE( Transform( "Hi" , "@R !!!" ) , "HI " ) - TEST_LINE( Transform( "Hallo ", "" ) , "Hallo " ) - - TEST_LINE( Transform( .T. , "" ) , "T" ) - TEST_LINE( Transform( .F. , "" ) , "F" ) - TEST_LINE( Transform( .T. , "L" ) , "T" ) - TEST_LINE( Transform( .F. , "L" ) , "F" ) - TEST_LINE( Transform( .T. , "Y" ) , "Y" ) - TEST_LINE( Transform( .F. , "Y" ) , "N" ) - TEST_LINE( Transform( .T. , "X" ) , "X" ) - TEST_LINE( Transform( .F. , "#" ) , "F" ) - TEST_LINE( Transform( .T. , "X!" ) , "X" ) - TEST_LINE( Transform( .F. , "@R Y" ) , "N" ) - TEST_LINE( Transform( .T. , "@R X!" ) , "X!T" ) - - TEST_LINE( Transform( SToD("20000101") , "@B" ) , "2000.01.01" ) - TEST_LINE( Transform( SToD("19901214") , "99/99/9999" ) , "1990.12.14" ) - TEST_LINE( Transform( SToD("19901202") , "99.99.9999" ) , "1990.12.02" ) - TEST_LINE( Transform( SToD("") , "99/99/9999" ) , " . . " ) - TEST_LINE( Transform( SToD("19901202") , "99/99/99" ) , "1990.12.02" ) - TEST_LINE( Transform( SToD("19901214") , "99-99-99" ) , "1990.12.14" ) - TEST_LINE( Transform( SToD("20040430") , "99.99.99" ) , "2004.04.30" ) - TEST_LINE( Transform( SToD("") , "99/99/99" ) , " . . " ) - TEST_LINE( Transform( SToD("19920101") , "THISWRNG" ) , "1992.01.01" ) - TEST_LINE( Transform( SToD("19350605") , "999/99/9" ) , "1935.06.05" ) - TEST_LINE( Transform( SToD("19101112") , "9#-9#/##" ) , "1910.11.12" ) - TEST_LINE( Transform( SToD("19920101") , "" ) , "1992.01.01" ) - TEST_LINE( Transform( SToD("19920101") , "DO THIS " ) , "1992.01.01" ) - TEST_LINE( Transform( SToD("19920102") , "@E" ) , "02/01/1992" ) /* Bug in CA-Cl*pper, it returns: "2.91901.02" */ - TEST_LINE( Transform( 1234 , "@D 9999" ) , "1234.00.0 " ) - TEST_LINE( Transform( 1234 , "@BD 9999" ) , "1234.00.0 " ) - - SET CENTURY OFF - - TEST_LINE( Transform( SToD("20000101") , "@B" ) , "00.01.01" ) - TEST_LINE( Transform( SToD("19901214") , "99/99/9999" ) , "90.12.14" ) - TEST_LINE( Transform( SToD("19901202") , "99.99.9999" ) , "90.12.02" ) - TEST_LINE( Transform( SToD("") , "99/99/9999" ) , " . . " ) - TEST_LINE( Transform( SToD("19901202") , "99/99/99" ) , "90.12.02" ) - TEST_LINE( Transform( SToD("19901214") , "99-99-99" ) , "90.12.14" ) - TEST_LINE( Transform( SToD("20040430") , "99.99.99" ) , "04.04.30" ) - TEST_LINE( Transform( SToD("") , "99/99/99" ) , " . . " ) - TEST_LINE( Transform( SToD("19920101") , "THISWRNG" ) , "92.01.01" ) - TEST_LINE( Transform( SToD("19350605") , "999/99/9" ) , "35.06.05" ) - TEST_LINE( Transform( SToD("19101112") , "9#-9#/##" ) , "10.11.12" ) - TEST_LINE( Transform( SToD("19920101") , "" ) , "92.01.01" ) - TEST_LINE( Transform( SToD("19920101") , "DO THIS " ) , "92.01.01" ) - TEST_LINE( Transform( SToD("19920102") , "@E" ) , "02/01/92" ) /* Bug in CA-Cl*pper, it returns: "01.92.02" */ - TEST_LINE( Transform( 1234 , "@D 9999" ) , "**.**.* " ) - TEST_LINE( Transform( 1234 , "@BD 9999" ) , "**.**.* " ) - - SET CENTURY ON - - TEST_LINE( Transform( 1 , "@b" ) , "1 " ) - TEST_LINE( Transform( 1 , "@B" ) , "1 " ) - TEST_LINE( Transform( 1.0 , "@B" ) , "1.0 " ) - TEST_LINE( Transform( 15 , "9999" ) , " 15" ) - TEST_LINE( Transform( 1.5 , "99.99" ) , " 1.50" ) - TEST_LINE( Transform( 1.5 , "9999" ) , " 2" ) - TEST_LINE( Transform( 15 , "####" ) , " 15" ) - TEST_LINE( Transform( 1.5 , "##.##" ) , " 1.50" ) - TEST_LINE( Transform( 1.5 , "####" ) , " 2" ) - TEST_LINE( Transform( 15 , " AX##" ) , " AX15" ) - TEST_LINE( Transform( 1.5 , "!9XPA.9" ) , "!1XPA.5" ) - TEST_LINE( Transform( -15 , "9999" ) , " -15" ) - TEST_LINE( Transform( -1.5 , "99.99" ) , "-1.50" ) - TEST_LINE( Transform( -15 , "$999" ) , "$-15" ) - TEST_LINE( Transform( -1.5 , "*9.99" ) , "-1.50" ) - TEST_LINE( Transform( 41 , "$$$9" ) , "$$41" ) - TEST_LINE( Transform( 41 , "***9" ) , "**41" ) - TEST_LINE( Transform( 15000 , "9999" ) , "****" ) - TEST_LINE( Transform( 15000 , "99,999" ) , "15,000" ) - TEST_LINE( Transform( 1500 , "99,999" ) , " 1,500" ) - TEST_LINE( Transform( 150 , "99,999" ) , " 150" ) - TEST_LINE( Transform( 150 , "99,99" ) , " 1,50" ) - TEST_LINE( Transform( 41 , "@Z 9999" ) , " 41" ) - TEST_LINE( Transform( 0 , "@Z 9999" ) , " " ) -#ifdef __HARBOUR__ - TEST_LINE( Transform( 41 , "@0 9999" ) , "0041" ) /* Extension in Harbour, in CA-Cl*pper it should return: " 41" */ - TEST_LINE( Transform( 0 , "@0 9999" ) , "0000" ) /* Extension in Harbour, in CA-Cl*pper it should return: " 0" */ -#endif - TEST_LINE( Transform( 41 , "@B 9999" ) , "41 " ) - TEST_LINE( Transform( 41 , "@B 99.9" ) , "41.0" ) - TEST_LINE( Transform( 7 , "@B 99.9" ) , "7.0 " ) - TEST_LINE( Transform( 7 , "@C 99.9" ) , " 7.0 CR" ) - TEST_LINE( Transform( -7 , "@C 99.9" ) , "-7.0" ) - TEST_LINE( Transform( 7 , "@X 99.9" ) , " 7.0" ) - TEST_LINE( Transform( -7 , "@X 99.9" ) , " 7.0 DB" ) - TEST_LINE( Transform( 7 , "@( 99.9" ) , " 7.0" ) - TEST_LINE( Transform( -7 , "@( 99.9" ) , "(7.0)" ) - TEST_LINE( Transform( 7 , "9X9Z5.9" ) , " X7Z5.0" ) - TEST_LINE( Transform( -7 , "@R 9X9^" ) , "-X7^" ) - TEST_LINE( Transform( -7 , "9X9^" ) , "-X7^" ) - TEST_LINE( Transform( 1 , "@R 9HI!" ) , "1HI!" ) - TEST_LINE( Transform( 1 , "9HI!" ) , "1HI!" ) - TEST_LINE( Transform( -12 , "@( 99" ) , "(*)" ) /* Bug in CA-Cl*pper, it returns: "(2)" */ - TEST_LINE( Transform( 12 , "@( 99" ) , "12" ) - TEST_LINE( Transform( 1 , "" ) , " 1" ) - TEST_LINE( Transform( 32768 , "" ) , " 32768" ) - TEST_LINE( Transform( -20 , "" ) , " -20" ) - TEST_LINE( Transform( 1048576 , "" ) , " 1048576" ) - TEST_LINE( Transform( 21.65 , "" ) , " 21.65" ) - TEST_LINE( Transform( -3.33 , "" ) , " -3.33" ) - TEST_LINE( Transform( -1234 , "@( 9999" ) , "(***)" ) /* Bug in CA-Cl*pper, it returns: "(234)" */ - TEST_LINE( Transform( -1234 , "@B 9999" ) , "****" ) - TEST_LINE( Transform( -1234 , "@B( 9999" ) , "(***)" ) /* Bug in CA-Cl*pper, it returns: "(234)" */ - TEST_LINE( Transform( 1234 , "@E 9,999.99" ) , "1.234,00" ) - TEST_LINE( Transform( 12.2 , "@E 9,999.99" ) , " 12,20" ) - TEST_LINE( Transform( -1234 , "@X 9999" ) , "1234 DB" ) - TEST_LINE( Transform( -1234 , "@BX 9999" ) , "1234 DB" ) - TEST_LINE( Transform( 1234 , "@B 9999" ) , "1234" ) - TEST_LINE( Transform( 1234 , "@BX 9999" ) , "1234" ) - TEST_LINE( Transform( 0 , "@Z 9999" ) , " " ) - TEST_LINE( Transform( 0 , "@BZ 9999" ) , " " ) - TEST_LINE( Transform( 2334 , "Xxxxx: #####") , "Xxxxx: 2334" ) - RETURN NIL FUNCTION Comp_Str() diff --git a/harbour/tests/regress/rt_trans.prg b/harbour/tests/regress/rt_trans.prg new file mode 100644 index 0000000000..e70c81a92c --- /dev/null +++ b/harbour/tests/regress/rt_trans.prg @@ -0,0 +1,352 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Regression tests for the runtime library (strings) + * + * Copyright 1999 Victor Szel + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +#include "rt_main.ch" + +STATIC scString +STATIC scStringM +STATIC scStringE +STATIC scStringZ +STATIC scStringW +STATIC snIntZ +STATIC snDoubleZ +STATIC snIntP +STATIC snIntP1 +STATIC snLongP +STATIC snDoubleP +STATIC snIntN +STATIC snLongN +STATIC snDoubleN +STATIC snDoubleI +STATIC sdDate +STATIC sdDateE +STATIC slFalse +STATIC slTrue +STATIC soObject +STATIC suNIL +STATIC sbBlock +STATIC sbBlockC +STATIC saArray +STATIC saAllTypes + +MEMVAR mxNotHere /* Please don't declare this variable, since it's used to test undeclared MEMVAR situations. */ +MEMVAR mcLongerNameThen10Chars +MEMVAR mcString +MEMVAR mcStringE +MEMVAR mcStringZ +MEMVAR mcStringW +MEMVAR mnIntZ +MEMVAR mnDoubleZ +MEMVAR mnIntP +MEMVAR mnLongP +MEMVAR mnDoubleP +MEMVAR mnDoubleI +MEMVAR mnIntN +MEMVAR mnLongN +MEMVAR mnDoubleN +MEMVAR mdDate +MEMVAR mdDateE +MEMVAR mlFalse +MEMVAR mlTrue +MEMVAR moObject +MEMVAR muNIL +MEMVAR mbBlock +MEMVAR mbBlockC +MEMVAR maArray + +INIT PROCEDURE RT_InitStatics() + + scString := "HELLO" + scStringM := "Hello" + scStringE := "" + scStringZ := "A" + Chr( 0 ) + "B" + scStringW := Chr(13)+Chr(10)+Chr(141)+Chr(10)+Chr(9) + snIntZ := 0 + snDoubleZ := 0.0 + snIntP := 10 + snIntP1 := 65 + snLongP := 100000 + snDoubleP := 10.567 /* Use different number of decimals than the default */ + snIntN := -10 + snLongN := -100000 + snDoubleN := -10.567 /* Use different number of decimals than the default */ + snDoubleI := 0 //Log( 0 ) + sdDate := SToD( "19800101" ) + sdDateE := SToD( "" ) + slFalse := .F. + slTrue := .T. + soObject := ErrorNew() + suNIL := NIL + sbBlock := {|| NIL } + sbBlockC := {|| "(string)" } + saArray := { 9898 } + + saAllTypes := {; + scString ,; + scStringE ,; + scStringZ ,; + snIntZ ,; + snDoubleZ ,; + snIntP ,; + snLongP ,; + snDoubleP ,; + snIntN ,; + snLongN ,; + snDoubleN ,; + snDoubleI ,; + sdDateE ,; + slFalse ,; + slTrue ,; + soObject ,; + suNIL ,; + sbBlock ,; + sbBlockC ,; + saArray } + + RETURN + +FUNCTION Main_TRANS() + + /* TRANSFORM() */ + + TEST_LINE( Transform( NIL , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( NIL , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( NIL , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {} , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {} , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {} , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( ErrorNew(), NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( ErrorNew(), "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( ErrorNew(), "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {|| NIL } , NIL ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {|| NIL } , "" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( {|| NIL } , "@" ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + + TEST_LINE( Transform( "", "" ) , "" ) + TEST_LINE( Transform( "", "@" ) , "" ) + TEST_LINE( Transform( "", NIL ) , "" ) + TEST_LINE( Transform( "", 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( "hello", "" ) , "hello" ) + TEST_LINE( Transform( "hello", "@" ) , "hello" ) + TEST_LINE( Transform( "hello", NIL ) , "hello" ) + TEST_LINE( Transform( "hello", 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( 100.2, "" ) , " 100.2" ) + TEST_LINE( Transform( 100.2, "@" ) , " 100.2" ) + TEST_LINE( Transform( 100.2, NIL ) , " 100.2" ) + TEST_LINE( Transform( 100.2, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( 100.20, "" ) , " 100.20" ) + TEST_LINE( Transform( 100.20, "@" ) , " 100.20" ) + TEST_LINE( Transform( 100.20, NIL ) , " 100.20" ) + TEST_LINE( Transform( 100.20, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( Val("100.2"), "" ) , "100.2" ) + TEST_LINE( Transform( Val("100.2"), "@" ) , "100.2" ) + TEST_LINE( Transform( Val("100.2"), NIL ) , "100.2" ) + TEST_LINE( Transform( Val("100.2"), 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( Val("100.20"), "" ) , "100.20" ) +// TEST_LINE( Transform( Val("100.20"), "@" ) , "100.20" ) + TEST_LINE( Transform( Val("100.20"), NIL ) , "100.20" ) + TEST_LINE( Transform( Val("100.20"), 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( sdDate, "" ) , "1980.01.01" ) + TEST_LINE( Transform( sdDate, "@" ) , "1980.01.01" ) + TEST_LINE( Transform( sdDate, NIL ) , "1980.01.01" ) + TEST_LINE( Transform( sdDate, 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + TEST_LINE( Transform( .T., "" ) , "T" ) + TEST_LINE( Transform( .T., "@" ) , "T" ) + TEST_LINE( Transform( .F., NIL ) , "F" ) + TEST_LINE( Transform( .F., 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + + TEST_LINE( Transform( scStringM , "!!!!!" ) , "HELLO" ) + TEST_LINE( Transform( scStringM , "@!" ) , "HELLO" ) +#ifdef __HARBOUR__ + TEST_LINE( Transform( @scStringM, "!!!!!" ) , "HELLO" ) /* Bug in CA-Cl*pper, it returns: "E BASE 1122 Argument error TRANSFORM F:S" */ + TEST_LINE( Transform( @scStringM, "@!" ) , "HELLO" ) /* Bug in CA-Cl*pper, it returns: "E BASE 1122 Argument error TRANSFORM F:S" */ +#endif + TEST_LINE( Transform( scStringM , "" ) , "Hello" ) + TEST_LINE( Transform( scStringM , NIL ) , "Hello" ) + TEST_LINE( Transform( scStringM , 100 ) , "E BASE 1122 Argument error TRANSFORM F:S" ) + + TEST_LINE( Transform("abcdef", "@! !lkm!") , "ABkmE" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! 1234567890"), "12345678I0" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyzabcdefg", "@! abcdefghijklmnopqrstuvwxyzabcdefg"), "AbcdefghijkLmNopqrstuvwXYzAbcdefg" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! `~!@#$% ^&*()_+-={}\|;':") , "`~C@E$% ^&*()_+-={}\|;':" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@! ,./<>?") , ",./<>?" ) + TEST_LINE( Transform("hello", " @!") , " @L" ) + + TEST_LINE( Transform("abcdef", "@R! !lkm!") , "ABkmC" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! 1234567890"), "12345678A0" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyzabcdefg", "@R! abcdefghijklmnopqrstuvwxyzabcdefg"), "AbcdefghijkBmCopqrstuvwDNzFbcdefg" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! `~!@#$% ^&*()_+-={}\|;':") , "`~A@B$% ^&*()_+-={}\|;':" ) + TEST_LINE( Transform("abcdefghijklmnopqrstuvwxyz", "@R! ,./<>?") , ",./<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) + TEST_LINE( Transform("hello", " @R!") , " @RL" ) + + TEST_LINE( Transform("abc", "@R !!!!") , "ABC " ) + TEST_LINE( Transform("abc", "@R XXXX") , "abc " ) + TEST_LINE( Transform("abc", "@R !!") , "AB" ) + TEST_LINE( Transform("abc", "@R XX") , "ab" ) + TEST_LINE( Transform("abc", "@!R !!!!") , "ABC " ) + TEST_LINE( Transform("abc", "@!R XXXX") , "ABC " ) + TEST_LINE( Transform("abc", "@!R !!") , "AB" ) + TEST_LINE( Transform("abc", "@!R XX") , "AB" ) + + TEST_LINE( Transform( "Hallo ", "!!!!!" ) , "HALLO" ) + TEST_LINE( Transform( "Hallo ", "!!A!!" ) , "HAlLO" ) + TEST_LINE( Transform( "Hallo ", "!!A9!" ) , "HAllO" ) + TEST_LINE( Transform( "Hallo ", "!QA9!" ) , "HQllO" ) + TEST_LINE( Transform( "Hallo ", "ZQA9!" ) , "ZQllO" ) + TEST_LINE( Transform( "Hall" , "ZQA9!" ) , "ZQll" ) + TEST_LINE( Transform( "Hallo ", "!AAA" ) , "Hall" ) + TEST_LINE( Transform( "Hallo ", "@!" ) , "HALLO " ) + TEST_LINE( Transform( "Hallo ", "@! AA" ) , "HA" ) + TEST_LINE( Transform( "Hallo ", "@R" ) , "Hallo " ) + TEST_LINE( Transform( "Hallo ", "@Z" ) , " " ) + TEST_LINE( Transform( "Hallo ", "@R !!" ) , "HA" ) + TEST_LINE( Transform( "Hi" , "@R !!!" ) , "HI " ) + TEST_LINE( Transform( "Hallo ", "" ) , "Hallo " ) + + TEST_LINE( Transform( .T. , "" ) , "T" ) + TEST_LINE( Transform( .F. , "" ) , "F" ) + TEST_LINE( Transform( .T. , "L" ) , "T" ) + TEST_LINE( Transform( .F. , "L" ) , "F" ) + TEST_LINE( Transform( .T. , "Y" ) , "Y" ) + TEST_LINE( Transform( .F. , "Y" ) , "N" ) + TEST_LINE( Transform( .T. , "X" ) , "X" ) + TEST_LINE( Transform( .F. , "#" ) , "F" ) + TEST_LINE( Transform( .T. , "X!" ) , "X" ) + TEST_LINE( Transform( .F. , "@R Y" ) , "N" ) + TEST_LINE( Transform( .T. , "@R X!" ) , "X!T" ) + + TEST_LINE( Transform( SToD("20000101") , "@B" ) , "2000.01.01" ) + TEST_LINE( Transform( SToD("19901214") , "99/99/9999" ) , "1990.12.14" ) + TEST_LINE( Transform( SToD("19901202") , "99.99.9999" ) , "1990.12.02" ) + TEST_LINE( Transform( SToD("") , "99/99/9999" ) , " . . " ) + TEST_LINE( Transform( SToD("19901202") , "99/99/99" ) , "1990.12.02" ) + TEST_LINE( Transform( SToD("19901214") , "99-99-99" ) , "1990.12.14" ) + TEST_LINE( Transform( SToD("20040430") , "99.99.99" ) , "2004.04.30" ) + TEST_LINE( Transform( SToD("") , "99/99/99" ) , " . . " ) + TEST_LINE( Transform( SToD("19920101") , "THISWRNG" ) , "1992.01.01" ) + TEST_LINE( Transform( SToD("19350605") , "999/99/9" ) , "1935.06.05" ) + TEST_LINE( Transform( SToD("19101112") , "9#-9#/##" ) , "1910.11.12" ) + TEST_LINE( Transform( SToD("19920101") , "" ) , "1992.01.01" ) + TEST_LINE( Transform( SToD("19920101") , "DO THIS " ) , "1992.01.01" ) + TEST_LINE( Transform( SToD("19920102") , "@E" ) , "02/01/1992" ) /* Bug in CA-Cl*pper, it returns: "2.91901.02" */ + TEST_LINE( Transform( 1234 , "@D 9999" ) , "1234.00.0 " ) + TEST_LINE( Transform( 1234 , "@BD 9999" ) , "1234.00.0 " ) + + SET CENTURY OFF + + TEST_LINE( Transform( SToD("20000101") , "@B" ) , "00.01.01" ) + TEST_LINE( Transform( SToD("19901214") , "99/99/9999" ) , "90.12.14" ) + TEST_LINE( Transform( SToD("19901202") , "99.99.9999" ) , "90.12.02" ) + TEST_LINE( Transform( SToD("") , "99/99/9999" ) , " . . " ) + TEST_LINE( Transform( SToD("19901202") , "99/99/99" ) , "90.12.02" ) + TEST_LINE( Transform( SToD("19901214") , "99-99-99" ) , "90.12.14" ) + TEST_LINE( Transform( SToD("20040430") , "99.99.99" ) , "04.04.30" ) + TEST_LINE( Transform( SToD("") , "99/99/99" ) , " . . " ) + TEST_LINE( Transform( SToD("19920101") , "THISWRNG" ) , "92.01.01" ) + TEST_LINE( Transform( SToD("19350605") , "999/99/9" ) , "35.06.05" ) + TEST_LINE( Transform( SToD("19101112") , "9#-9#/##" ) , "10.11.12" ) + TEST_LINE( Transform( SToD("19920101") , "" ) , "92.01.01" ) + TEST_LINE( Transform( SToD("19920101") , "DO THIS " ) , "92.01.01" ) + TEST_LINE( Transform( SToD("19920102") , "@E" ) , "02/01/92" ) /* Bug in CA-Cl*pper, it returns: "01.92.02" */ + TEST_LINE( Transform( 1234 , "@D 9999" ) , "**.**.* " ) + TEST_LINE( Transform( 1234 , "@BD 9999" ) , "**.**.* " ) + + SET CENTURY ON + + TEST_LINE( Transform( 1 , "@b" ) , "1 " ) + TEST_LINE( Transform( 1 , "@B" ) , "1 " ) + TEST_LINE( Transform( 1.0 , "@B" ) , "1.0 " ) + TEST_LINE( Transform( 15 , "9999" ) , " 15" ) + TEST_LINE( Transform( 1.5 , "99.99" ) , " 1.50" ) + TEST_LINE( Transform( 1.5 , "9999" ) , " 2" ) + TEST_LINE( Transform( 15 , "####" ) , " 15" ) + TEST_LINE( Transform( 1.5 , "##.##" ) , " 1.50" ) + TEST_LINE( Transform( 1.5 , "####" ) , " 2" ) + TEST_LINE( Transform( 15 , " AX##" ) , " AX15" ) + TEST_LINE( Transform( 1.5 , "!9XPA.9" ) , "!1XPA.5" ) + TEST_LINE( Transform( -15 , "9999" ) , " -15" ) + TEST_LINE( Transform( -1.5 , "99.99" ) , "-1.50" ) + TEST_LINE( Transform( -15 , "$999" ) , "$-15" ) + TEST_LINE( Transform( -1.5 , "*9.99" ) , "-1.50" ) + TEST_LINE( Transform( 41 , "$$$9" ) , "$$41" ) + TEST_LINE( Transform( 41 , "***9" ) , "**41" ) + TEST_LINE( Transform( 15000 , "9999" ) , "****" ) + TEST_LINE( Transform( 15000 , "99,999" ) , "15,000" ) + TEST_LINE( Transform( 1500 , "99,999" ) , " 1,500" ) + TEST_LINE( Transform( 150 , "99,999" ) , " 150" ) + TEST_LINE( Transform( 150 , "99,99" ) , " 1,50" ) + TEST_LINE( Transform( 41 , "@Z 9999" ) , " 41" ) + TEST_LINE( Transform( 0 , "@Z 9999" ) , " " ) +#ifdef __HARBOUR__ + TEST_LINE( Transform( 41 , "@0 9999" ) , "0041" ) /* Extension in Harbour, in CA-Cl*pper it should return: " 41" */ + TEST_LINE( Transform( 0 , "@0 9999" ) , "0000" ) /* Extension in Harbour, in CA-Cl*pper it should return: " 0" */ +#endif + TEST_LINE( Transform( 41 , "@B 9999" ) , "41 " ) + TEST_LINE( Transform( 41 , "@B 99.9" ) , "41.0" ) + TEST_LINE( Transform( 7 , "@B 99.9" ) , "7.0 " ) + TEST_LINE( Transform( 7 , "@C 99.9" ) , " 7.0 CR" ) + TEST_LINE( Transform( -7 , "@C 99.9" ) , "-7.0" ) + TEST_LINE( Transform( 7 , "@X 99.9" ) , " 7.0" ) + TEST_LINE( Transform( -7 , "@X 99.9" ) , " 7.0 DB" ) + TEST_LINE( Transform( 7 , "@( 99.9" ) , " 7.0" ) + TEST_LINE( Transform( -7 , "@( 99.9" ) , "(7.0)" ) + TEST_LINE( Transform( 7 , "9X9Z5.9" ) , " X7Z5.0" ) + TEST_LINE( Transform( -7 , "@R 9X9^" ) , "-X7^" ) + TEST_LINE( Transform( -7 , "9X9^" ) , "-X7^" ) + TEST_LINE( Transform( 1 , "@R 9HI!" ) , "1HI!" ) + TEST_LINE( Transform( 1 , "9HI!" ) , "1HI!" ) + TEST_LINE( Transform( -12 , "@( 99" ) , "(*)" ) /* Bug in CA-Cl*pper, it returns: "(2)" */ + TEST_LINE( Transform( 12 , "@( 99" ) , "12" ) + TEST_LINE( Transform( 1 , "" ) , " 1" ) + TEST_LINE( Transform( 32768 , "" ) , " 32768" ) + TEST_LINE( Transform( -20 , "" ) , " -20" ) + TEST_LINE( Transform( 1048576 , "" ) , " 1048576" ) + TEST_LINE( Transform( 21.65 , "" ) , " 21.65" ) + TEST_LINE( Transform( -3.33 , "" ) , " -3.33" ) + TEST_LINE( Transform( -1234 , "@( 9999" ) , "(***)" ) /* Bug in CA-Cl*pper, it returns: "(234)" */ + TEST_LINE( Transform( -1234 , "@B 9999" ) , "****" ) + TEST_LINE( Transform( -1234 , "@B( 9999" ) , "(***)" ) /* Bug in CA-Cl*pper, it returns: "(234)" */ + TEST_LINE( Transform( 1234 , "@E 9,999.99" ) , "1.234,00" ) + TEST_LINE( Transform( 12.2 , "@E 9,999.99" ) , " 12,20" ) + TEST_LINE( Transform( -1234 , "@X 9999" ) , "1234 DB" ) + TEST_LINE( Transform( -1234 , "@BX 9999" ) , "1234 DB" ) + TEST_LINE( Transform( 1234 , "@B 9999" ) , "1234" ) + TEST_LINE( Transform( 1234 , "@BX 9999" ) , "1234" ) + TEST_LINE( Transform( 0 , "@Z 9999" ) , " " ) + TEST_LINE( Transform( 0 , "@BZ 9999" ) , " " ) + TEST_LINE( Transform( 2334 , "Xxxxx: #####") , "Xxxxx: 2334" ) + + RETURN NIL +