Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: test/mjsunit/mirror-number.js

Issue 18445: Changes to the mirror handling... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Test text representation 47 // Test text representation
48 assertEquals(String(n), mirror.toText()); 48 assertEquals(String(n), mirror.toText());
49 49
50 // Parse JSON representation and check. 50 // Parse JSON representation and check.
51 var fromJSON = eval('(' + json + ')'); 51 var fromJSON = eval('(' + json + ')');
52 assertEquals('number', fromJSON.type); 52 assertEquals('number', fromJSON.type);
53 if (!isNaN(n)) { 53 if (!isNaN(n)) {
54 assertEquals(n, fromJSON.value); 54 assertEquals(n, fromJSON.value);
55 } else { 55 } else {
56 assertTrue(isNaN(fromJSON.value)); 56 // NaN values are encoded as strings.
57 assertTrue(typeof fromJSON.value == 'string');
58 if (n === Infinity) {
59 assertEquals('Infinity', fromJSON.value);
60 } else if (n === -Infinity) {
61 assertEquals('-Infinity', fromJSON.value);
62 } else {
63 assertEquals('NaN', fromJSON.value);
64 }
57 } 65 }
58 } 66 }
59 67
60 68
61 // Test a number of different numbers. 69 // Test a number of different numbers.
62 testNumberMirror(-7); 70 testNumberMirror(-7);
63 testNumberMirror(-6.5); 71 testNumberMirror(-6.5);
64 testNumberMirror(0); 72 testNumberMirror(0);
65 testNumberMirror(42); 73 testNumberMirror(42);
66 testNumberMirror(100.0002); 74 testNumberMirror(100.0002);
67 testNumberMirror(Infinity); 75 testNumberMirror(Infinity);
68 testNumberMirror(-Infinity); 76 testNumberMirror(-Infinity);
69 testNumberMirror(NaN); 77 testNumberMirror(NaN);
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/mirror-object.js » ('j') | test/mjsunit/mirror-object.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698