diff --git a/src/test/resources/modules/std/parseInt.own b/src/test/resources/modules/std/parseInt.own new file mode 100644 index 0000000..7aa4a29 --- /dev/null +++ b/src/test/resources/modules/std/parseInt.own @@ -0,0 +1,17 @@ +use "std" + +def testParseInt() { + assertEquals(141, parseInt("141")) +} + +def testParseIntBin() { + assertEquals(141, parseInt("10001101", 2)) +} + +def testParseIntOct() { + assertEquals(141, parseInt("215", 8)) +} + +def testParseIntHex() { + assertEquals(141, parseInt("8D", 16)) +} \ No newline at end of file diff --git a/src/test/resources/modules/std/parseLong.own b/src/test/resources/modules/std/parseLong.own new file mode 100644 index 0000000..77d426d --- /dev/null +++ b/src/test/resources/modules/std/parseLong.own @@ -0,0 +1,18 @@ +use "std" + +def testParseInt() { + assertEquals(12345654321, parseLong("12345654321")) +} + +def testParseIntBin() { + assertEquals(12345654321, parseLong("1011011111110110111011110000110001", 2)) +} + +def testParseIntOct() { + assertEquals(12345654321, parseLong("133766736061", 8)) +} + +def testParseIntHex() { + assertEquals(#2DFDBBC31, parseLong("2DFDBBC31", 16)) + assertEquals(12345654321, parseLong("2DFDBBC31", 16)) +} \ No newline at end of file diff --git a/src/test/resources/modules/std/toHexString.own b/src/test/resources/modules/std/toHexString.own new file mode 100644 index 0000000..f557fc1 --- /dev/null +++ b/src/test/resources/modules/std/toHexString.own @@ -0,0 +1,7 @@ +use "std" + +def testToHexString() { + assertEquals("8d", toHexString(141)) + assertEquals("cafebabe", toHexString(#CAFEBABE)) + assertEquals("2dfdbbc31", toHexString(12345654321)) +}