Espruino/tests/test_number_syntax.js
Michael Duerinckx 7f5308590b Rename numbered tests to something more descriptive - closes #16
test077 is the only one I really couldn't figure out what it was meant
to test.
2014-03-01 22:15:28 +00:00

14 lines
531 B
JavaScript

// Number definition from http://en.wikipedia.org/wiki/JavaScript_syntax
a = 345; // an "integer", although there is only one numeric type in JavaScript
b = 34.5; // a floating-point number
c = 3.45e2; // another floating-point, equivalent to 345
d = 0377; // an octal integer equal to 255
e = 0xFF; // a hexadecimal integer equal to 255, digits represented by the letters A-F may be upper or lowercase
results = [a==345, b*10==345, c==345, d==255, e==255];
result = 1;
for (i in results)
if (!results[i])
result=0;