Revision: 1791
          http://svn.sourceforge.net/vexi/?rev=1791&view=rev
Author:   clrg
Date:     2007-04-05 09:34:06 -0700 (Thu, 05 Apr 2007)

Log Message:
-----------
Add basic parseFloat test + tidy up a bit

Modified Paths:
--------------
    core/trunk/org.ibex.js/src_junit/test/js/string/testNumber2String.js

Modified: core/trunk/org.ibex.js/src_junit/test/js/string/testNumber2String.js
===================================================================
--- core/trunk/org.ibex.js/src_junit/test/js/string/testNumber2String.js        
2007-04-04 12:25:48 UTC (rev 1790)
+++ core/trunk/org.ibex.js/src_junit/test/js/string/testNumber2String.js        
2007-04-05 16:34:06 UTC (rev 1791)
@@ -1,46 +1,49 @@
 sys.import("lib");
-               assert(256 == "256");     // Strings in a numeric context are
-               assert(256.0 == "256");   // converted to a number.  This is
-               assert(256 == "256.0");  // usually reasonable and useful.
-               assert("256" != "256.0"); // (String context, no convert! M)
-               //assert(256    == "0x100");    // Hexadecimal 0x prefix works,
-               assert(256      == "0256");     // but no octal 0 prefix this 
way.
-               assert(256 != "256 xyz");  // No extraneous characters.
-       
-               // Number ? String
-               assert(256      === "256" - 0); //- converts string to number
-               assert("2560" === "256" + 0); // + concatenates stringsM
-               assert(256      === parseInt("256"));
-               assert(256      === parseInt("256 xyz"));  // (extras forgiven)
-               assert(256      === parseInt("0x100"));    // (hexadecimal)
-               assert(256      === parseInt("0400"));      // (0 for octal M)
-               assert(256      === parseInt("0256",10)); // (certain decimal)
-               assert(256      === parseInt("100",16));   // (hexadecimal)
-               assert(256      === parseInt("400",8));     // (octal)
-               //assert(25.6   === parseFloat("2.56e1"));
-               
-               skip("valueOf");
-               //assert("256" === "256".valueOf());  // (no conversion help)
-       
-               // Number ? String
-               assertEquals(256 + ""   ,"256");
-               assertEquals((256).toString()   ,"256");
-               assertEquals((2.56).toString(), "2.56");
-               skip("To int to string with base specified");
-               //assertEquals((256).toString(16), "100");       // (hex)
-               //assertEquals((256).toString(8),  "400");       // (octal)
-               //assertEquals((256).toString(4),  "10000");     // (base 4)
-               //assertEquals((256).toString(2),  "100000000"); // (binary)
-               sys.print((25.6).toString(16));
-               //assertEquals((25.6).toString(16),"19.99999999999a"); // (hex 
non-integer)
-               //assertEquals((25).toString(16),"19"); 
-               //assertEquals((25.6).toString(10)      , "25.6"); // (hex)
-       
-               skip("toFixed not implemented");
-               //assertEquals((2.56).toFixed(),"3");
-               //assertEquals((2.56).toFixed(3),"2.560");
-               skip("toPrecision not implemented");
-               //assertEquals((2.56).toPrecision(2),"2.6");
-               skip("toExponential not implemented");
-               //assertEquals((256).toExponential(4),"2.5600e+2");
-               
\ No newline at end of file
+        assert(256 == "256");     // Strings in a numeric context are
+        assert(256.0 == "256");   // converted to a number.  This is
+        assert(256 == "256.0");   // usually reasonable and useful.
+        assert("256" != "256.0"); // (String context, no convert! M)
+        //assert(256 == "0x100");   // Hexadecimal 0x prefix works,
+        assert(256 == "0256");    // but no octal 0 prefix this way.
+        assert(256 != "256 xyz"); // No extraneous characters.
+    
+        // Number ? String
+        assert(256    === "256" - 0); // - converts string to number
+        assert("2560" === "256" + 0); // + concatenates strings
+        assert(256    === parseInt("256"));
+        assert(256    === parseInt("256 xyz")); // (extras forgiven)
+        assert(256    === parseInt("0x100"));   // (hexadecimal)
+        assert(256    === parseInt("0400"));    // (0 for octal M)
+        assert(256    === parseInt("0256",10)); // (certain decimal)
+        assert(256    === parseInt("100",16));  // (hexadecimal)
+        assert(256    === parseInt("400",8));   // (octal)
+        
+        // Floats
+        assert(25.6 === parseFloat("25.6"));
+        //assert(25.6    === parseFloat("2.56e1"));
+        
+        skip("valueOf");
+        //assert("256" === "256".valueOf());  // (no conversion help)
+    
+        // Number ? String
+        assertEquals(256 + ""    ,"256");
+        assertEquals((256).toString()    ,"256");
+        assertEquals((2.56).toString(), "2.56");
+        skip("To int to string with base specified");
+        //assertEquals((256).toString(16), "100");       // (hex)
+        //assertEquals((256).toString(8),  "400");       // (octal)
+        //assertEquals((256).toString(4),  "10000");     // (base 4)
+        //assertEquals((256).toString(2),  "100000000"); // (binary)
+        sys.print((25.6).toString(16));
+        //assertEquals((25.6).toString(16),"19.99999999999a"); // (hex 
non-integer)
+        //assertEquals((25).toString(16),"19"); 
+        //assertEquals((25.6).toString(10)    , "25.6"); // (hex)
+    
+        skip("toFixed not implemented");
+        //assertEquals((2.56).toFixed(),"3");
+        //assertEquals((2.56).toFixed(3),"2.560");
+        skip("toPrecision not implemented");
+        //assertEquals((2.56).toPrecision(2),"2.6");
+        skip("toExponential not implemented");
+        //assertEquals((256).toExponential(4),"2.5600e+2");
+        
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to