= #JxnPortable\docs\programmer_examples\demos\NumericLiteral_workaround_UnitTest.jxn

#ifndef noFiles
! run as single file
resetAll = true
#else
! run as part of a set of multiple files
noFiles = noFiles + 1
resetAll = false
#endif

#ifndef ut
@Date()
ut = @JxnUnitTest();
#endif

! reset debug to default (abort on unexpected exception => must be recognized and fixed e.g. using $this.test( "..." ) )
oldDebug = $this.setAbort( true )


ut.assertEquals( "char:@", JxnParameterCheck.whatIs( Short.parseShort( "100", 8 ).charValue() ) )  ! for '\100' (octal)

#import static JxnParameterCheck  ! for whatIs

ut.assertEquals( "int:12",  whatIs( Integer.parseUnsignedInt( "1100", 2 ) ) )  ! for 0b1100 (binary)
ut.assertEquals( "int:-12", whatIs( Integer.parseUnsignedInt( "11111111111111111111111111110100", 2 ) ) )
ut.assertEquals( "int:12",  whatIs( Integer.parseUnsignedInt( "014", 8 ) ) )  ! for 014 (octal)
ut.assertEquals( "int:-12", whatIs( Integer.parseUnsignedInt( "037777777764", 8 ) ) )  ! for 037777777764 (octal)
ut.assertEquals( "int:123456789",  whatIs( parseHex( "075b_cd15" ).intValue() ) )  ! for 0x075b_cd15
ut.assertEquals( "int:-123456789", whatIs( parseHex( "f8a4_32eb" ).intValue() ) )  ! for 0xf8a4_32eb

ut.assertEquals( "long:12",  whatIs( (12).longValue() ) )  ! for 12L
ut.assertEquals( "long:-12", whatIs( (-12).longValue() ) )  ! for -12L
ut.assertEquals( "long:12",  whatIs( parseHex( "c" ).longValue() ) )  ! for 0xcL
ut.assertEquals( "long:-12", whatIs( parseHex( "ffff_ffff_ffff_fff4" ).longValue() ) )  ! for 0xffff_ffff_ffff_fff4L
ut.assertEquals( "long:1234567890987654321",  whatIs(  1234567890987654321 ) )  ! for  1234567890987654321L
ut.assertEquals( "long:-1234567890987654321", whatIs( -1234567890987654321 ) )  ! for -1234567890987654321L
ut.assertEquals( "long:1234567890987654321",  whatIs( parseHex( "1122_10f4_b16c_1cb1" ).longValue() ) )  ! for 0x1122_10f4_b16c_1cb1L
ut.assertEquals( "long:-1234567890987654321", whatIs( parseHex( "eedd_ef0b_4e93_e34f" ).longValue() ) )  ! for 0xeedd_ef0b_4e93_e34fL

ut.assertEquals( "float:1.25",    whatIs( ( 1.25).floatValue() ) )  ! for  1.25f
ut.assertEquals( "float:-1.25",   whatIs( (-1.25).floatValue() ) )  ! for -1.25f
ut.assertEquals( "float:1025.5",  whatIs( Float.parseFloat( " 0x1.006p10" ) ) )  ! for  0x1.006p10f
ut.assertEquals( "float:-1025.5", whatIs( Float.parseFloat( "-0x1.006p10" ) ) )  ! for -0x1.006p10f

ut.assertEquals( "double:1.2345678909876543",  whatIs( Double.parseDouble( " 0x1.3c0ca42c7bd1bp0" ) ) )
ut.assertEquals( "double:-1.2345678909876543", whatIs( Double.parseDouble( "-0x1.3c0ca42c7bd1bp0" ) ) )


! >>> keep/move this block at/to end of file >>>
$this.setDebug(oldDebug)

ut.summary()
JxnUnitTestFailureExpected.summaryAll( resetAll )
! <<< keep/move this block at/to end of file <<<