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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -11,208 +11,239 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define EOL chr(10)
|
||||
#xtranslate QQOUT([<x,...>]) => [OUTSTD(<x>)]
|
||||
#xtranslate QOUT([<x,...>]) => OUTSTD(EOL)[;OUTSTD(<x>)]
|
||||
#xtranslate QOUT([<x,...>]) => OUTSTD(hb_eol())[;OUTSTD(<x>)]
|
||||
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 "<YY:DD.MM>"
|
||||
? transtest( dt, "@E", "<31:12.87>")
|
||||
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")
|
||||
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 "<YY:DD.MM>"
|
||||
? transtest( dt, "@E", "<31:12.87>" )
|
||||
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" )
|
||||
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! <XXXXXXXX>", "<BCDEFGHI>")
|
||||
? transtest("abcdefghij","@S0! <XXXXXXXX>", "<BCDEFGHI>")
|
||||
? transtest("abcdefghij","@S5! <XXXXXXXX>", "<BCDE")
|
||||
stop()
|
||||
set fixed on
|
||||
? transtest( 1234, , " 1234" )
|
||||
? transtest( 1234, "" , " 1234" )
|
||||
? transtest( 1234, "@" , " 1234" )
|
||||
? transtest( 1234, "@!", " 1234" )
|
||||
? transtest( -1234, , " -1234" )
|
||||
? transtest( -1234, "@" , " -1234" )
|
||||
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! <XXXXXXXX>", "<BCDEFGHI>" )
|
||||
? transtest( "abcdefghij", "@S0! <XXXXXXXX>", "<BCDEFGHI>" )
|
||||
? transtest( "abcdefghij", "@S5! <XXXXXXXX>", "<BCDE" )
|
||||
stop()
|
||||
SET FIXED ON
|
||||
? transtest( 1234, , " 1234" )
|
||||
? transtest( 1234, "" , " 1234" )
|
||||
? transtest( 1234, "@" , " 1234" )
|
||||
? transtest( 1234, "@!", " 1234" )
|
||||
? transtest( - 1234, , " -1234" )
|
||||
? transtest( - 1234, "@" , " -1234" )
|
||||
#ifdef HB_CLP_STRICT
|
||||
? transtest( round(123,0), , " 123.00" )
|
||||
? transtest( round(123,0), "@!", " 123.00" )
|
||||
? transtest( round(123.0,0), , " 123.00" )
|
||||
? transtest( round(123.0,0),"@!", " 123.00" )
|
||||
? transtest( Round( 123,0 ), , " 123.00" )
|
||||
? transtest( Round( 123,0 ), "@!", " 123.00" )
|
||||
? transtest( Round( 123.0,0 ), , " 123.00" )
|
||||
? transtest( Round( 123.0,0 ), "@!", " 123.00" )
|
||||
#endif
|
||||
stop()
|
||||
? transtest( 1234.567, , " 1234.57" )
|
||||
? transtest( 1234.567, "", " 1234.57" )
|
||||
? transtest( 1234.567, "@" , " 1234.57" )
|
||||
? transtest( 1234.567, "@!", " 1234.57" )
|
||||
? transtest( -1234.567, , " -1234.57" )
|
||||
? transtest( -1234.567, "@", " -1234.57" )
|
||||
? transtest( val("-1.0"), , "-1.00" )
|
||||
? transtest( val("-1.0"), "@", "-1.00" )
|
||||
? transtest( val("-123"), , " -123" )
|
||||
? transtest( val("-123"), "@", " -123" )
|
||||
? transtest( 0, , " 0" )
|
||||
? transtest( 0.0, , " 0.00" )
|
||||
? transtest( val("1"), , " 1" )
|
||||
? transtest( val("12"), , " 12" )
|
||||
? transtest( val("123"), , " 123" )
|
||||
? transtest( val("1234"), , " 1234" )
|
||||
stop()
|
||||
set decimal to 3
|
||||
? transtest( 0.0, , " 0.000" )
|
||||
? transtest( val("1"), , " 1" )
|
||||
? transtest( val("12"), , " 12" )
|
||||
? transtest( val("123"), , " 123" )
|
||||
? transtest( val("1234"), , " 1234" )
|
||||
set decimal to 4
|
||||
? transtest( 0.0, , " 0.0000" )
|
||||
? transtest( val("1"), , " 1" )
|
||||
? transtest( val("12"), , " 12" )
|
||||
? transtest( val("123"), , " 123" )
|
||||
? transtest( val("1234"), , " 1234" )
|
||||
set fixed off
|
||||
stop()
|
||||
? transtest( -1234, , " -1234" )
|
||||
? transtest( -1234, "@B", "-1234 " )
|
||||
? transtest( -1234, "@(", "( 1234)" )
|
||||
? transtest( -1234, "@)", " (1234)" )
|
||||
? transtest( -1234, "@B)", "(1234) " )
|
||||
? transtest( -1234, "@B(", "(1234) " )
|
||||
? transtest( "( 12)", "@B(", "( 12)" )
|
||||
? transtest( "( 12)", "@B)", "( 12)" )
|
||||
? transtest( " 12", "@B(", "12 " )
|
||||
? transtest( " 12", "@B)", "12 " )
|
||||
stop()
|
||||
? transtest( 1234.567, , " 1234.57" )
|
||||
? transtest( 1234.567, "", " 1234.57" )
|
||||
? transtest( 1234.567, "@" , " 1234.57" )
|
||||
? transtest( 1234.567, "@!", " 1234.57" )
|
||||
? transtest( - 1234.567, , " -1234.57" )
|
||||
? transtest( - 1234.567, "@", " -1234.57" )
|
||||
? transtest( Val( "-1.0" ), , "-1.00" )
|
||||
? transtest( Val( "-1.0" ), "@", "-1.00" )
|
||||
? transtest( Val( "-123" ), , " -123" )
|
||||
? transtest( Val( "-123" ), "@", " -123" )
|
||||
? transtest( 0, , " 0" )
|
||||
? transtest( 0.0, , " 0.00" )
|
||||
? transtest( Val( "1" ), , " 1" )
|
||||
? transtest( Val( "12" ), , " 12" )
|
||||
? transtest( Val( "123" ), , " 123" )
|
||||
? transtest( Val( "1234" ), , " 1234" )
|
||||
stop()
|
||||
SET DECIMAL TO 3
|
||||
? transtest( 0.0, , " 0.000" )
|
||||
? transtest( Val( "1" ), , " 1" )
|
||||
? transtest( Val( "12" ), , " 12" )
|
||||
? transtest( Val( "123" ), , " 123" )
|
||||
? transtest( Val( "1234" ), , " 1234" )
|
||||
SET DECIMAL TO 4
|
||||
? transtest( 0.0, , " 0.0000" )
|
||||
? transtest( Val( "1" ), , " 1" )
|
||||
? transtest( Val( "12" ), , " 12" )
|
||||
? transtest( Val( "123" ), , " 123" )
|
||||
? transtest( Val( "1234" ), , " 1234" )
|
||||
SET FIXED OFF
|
||||
stop()
|
||||
? transtest( - 1234, , " -1234" )
|
||||
? transtest( - 1234, "@B", "-1234 " )
|
||||
? transtest( - 1234, "@(", "( 1234)" )
|
||||
? transtest( - 1234, "@)", " (1234)" )
|
||||
? transtest( - 1234, "@B)", "(1234) " )
|
||||
? transtest( - 1234, "@B(", "(1234) " )
|
||||
? transtest( "( 12)", "@B(", "( 12)" )
|
||||
? transtest( "( 12)", "@B)", "( 12)" )
|
||||
? transtest( " 12", "@B(", "12 " )
|
||||
? transtest( " 12", "@B)", "12 " )
|
||||
#ifdef __HARBOUR__
|
||||
? transtest( 1234, "@L", "0000001234" )
|
||||
? transtest( 1234, "@0", "0000001234" )
|
||||
? transtest( 1234, "@L(", "0000001234" )
|
||||
? transtest( 1234, "@0)", "0000001234" )
|
||||
? transtest( -1234, "@L(", "(000001234)" )
|
||||
? transtest( -1234, "@0)", "(000001234)" )
|
||||
/* please test it with FoxPro and Xbase++ to check if they give the same result */
|
||||
? transtest( -1234, "@L", "-000001234" )
|
||||
? transtest( -1234, "@0", "-000001234" )
|
||||
? transtest( 1234, "@L", "0000001234" )
|
||||
? transtest( 1234, "@0", "0000001234" )
|
||||
? transtest( 1234, "@L(", "0000001234" )
|
||||
? transtest( 1234, "@0)", "0000001234" )
|
||||
? transtest( - 1234, "@L(", "(000001234)" )
|
||||
? transtest( - 1234, "@0)", "(000001234)" )
|
||||
/* please test it with FoxPro and Xbase++ to check if they give the same result */
|
||||
? transtest( - 1234, "@L", "-000001234" )
|
||||
? transtest( - 1234, "@0", "-000001234" )
|
||||
#endif
|
||||
/* FlagShip extensions */
|
||||
? transtest( -1234, "@Z", " -1234" )
|
||||
? transtest( 1234, "@Z", " 1234" )
|
||||
? transtest( -1234, "@F", " -1234" )
|
||||
? transtest( 1234, "@F", " 1234" )
|
||||
? transtest( -1234, "@T", " -1234" )
|
||||
? transtest( 1234, "@T", " 1234" )
|
||||
/* FlagShip extensions */
|
||||
? transtest( - 1234, "@Z", " -1234" )
|
||||
? transtest( 1234, "@Z", " 1234" )
|
||||
? transtest( - 1234, "@F", " -1234" )
|
||||
? transtest( 1234, "@F", " 1234" )
|
||||
? transtest( - 1234, "@T", " -1234" )
|
||||
? transtest( 1234, "@T", " 1234" )
|
||||
|
||||
? transtest( 123456789.12, "@,39 999,999,999.99", "123,456,789.12" )
|
||||
? transtest( 123456789.12, "@,39 999,999,999.99", "123,456,789.12" )
|
||||
? transtest( 123.456, "@R 9 9 9.9", "1 2 3.5" )
|
||||
stop()
|
||||
return
|
||||
? transtest( 123456789.12, "@,39 999,999,999.99", "123,456,789.12" )
|
||||
? transtest( 123456789.12, "@,39 999,999,999.99", "123,456,789.12" )
|
||||
? transtest( 123.456, "@R 9 9 9.9", "1 2 3.5" )
|
||||
stop()
|
||||
|
||||
RETURN
|
||||
|
||||
#ifndef __HARBOUR__
|
||||
func stod(s)
|
||||
local cDf:=set(_SET_DATEFORMAT,"YYYY/MM/DD"), dt
|
||||
dt:=ctod(stuff(stuff(s,7,0,"/"),5,0,"/"))
|
||||
set(_SET_DATEFORMAT,cDf)
|
||||
return dt
|
||||
|
||||
FUNC SToD( s )
|
||||
|
||||
LOCAL cDf := Set( _SET_DATEFORMAT, "YYYY/MM/DD" ), dt
|
||||
|
||||
dt := CToD( Stuff( Stuff( s, 7, 0, "/" ), 5, 0, "/" ) )
|
||||
SET( _SET_DATEFORMAT, cDf )
|
||||
|
||||
RETURN dt
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,4 +18,3 @@ void hb_cmdargTEST( void )
|
||||
printf(" Fn: %i\n", hb_cmdargNum( "F" ) );
|
||||
printf("TEMP: %s\n", pszArg = hb_cmdargString( "TEMP" ) ); if( pszArg ) hb_xfree( pszArg );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user