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

Side by Side Diff: test/codegen/expect/corelib/num_sign_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
(Empty)
1 dart_library.library('corelib/num_sign_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__num_sign_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const _interceptors = dart_sdk._interceptors;
8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect;
11 const num_sign_test = Object.create(null);
12 let JSArrayOfnum = () => (JSArrayOfnum = dart.constFn(_interceptors.JSArray$(c ore.num)))();
13 let numTonum = () => (numTonum = dart.constFn(dart.definiteFunctionType(core.n um, [core.num])))();
14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
15 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
16 num_sign_test.sign = function(value) {
17 if (typeof value == 'number') {
18 if (dart.notNull(value) < 0) return -1;
19 if (dart.notNull(value) > 0) return 1;
20 return 0;
21 }
22 if (dart.test(value[dartx.isNaN])) return value;
23 if (value == 0.0) return value;
24 if (dart.notNull(value) > 0.0) return 1.0;
25 return -1.0;
26 };
27 dart.fn(num_sign_test.sign, numTonum());
28 dart.defineLazy(num_sign_test, {
29 get numbers() {
30 return JSArrayOfnum().of([0, 1, 2, 127, 128, 255, 256, 65535, 65536, 10737 41823, 1073741824, 1073741825, 2147483647, 2147483648, 2147483649, 68719476735, 4294967296, 4294967297, 4503599627370496, 4503599627370497, 9007199254740991, 90 07199254740992, 9007199254740993, 9007199254740994, 9223372036854775807, 9223372 036854775808, 9223372036854775809, 18446744073709551615, 18446744073709551616, 1 8446744073709551617, 17976931348623157081452742373170435679807056752584499659891 74768031572607800285387605895586327668781715404589535143824642343213268894641827 68467546703537516986049910576551282076245490090389328944075868508455133942304583 23690322294816580855933212334827479782620414472316873817718091929988125040402618 4124858368, 17976931348623158079372897140530341507993413271003782693617377898044 49682927647509466490179775872070963302864166928879109465555478519404026306574886 71505820681908902000708383676273854845817711531764475730270069855571366959622842 91481986083493647529271907416844436551070434271155969950809304288017790417449779 2, 17976931348623159077293051907890247336179769789423065727343008115773267580550 09631327084773224075360211201138798713933576587897688144166224928474306394741243 77767893424865485276302219601246094119453082952085005768838150682342462881473913 110540827237163350510684586298239947245938479716304835356329624224137216, 0.0, 5 e-324, 2.225073858507201e-308, 2.2250738585072014e-308, 0.49999999999999994, 0.5 , 0.5000000000000001, 0.9999999999999999, 1.0, 1.0000000000000002, 4294967295.0, 4294967296.0, 4503599627370495.5, 4503599627370497.0, 9007199254740991.0, 90071 99254740992.0, 1.7976931348623157e+308, 1.0 / 0.0, 0.0 / 0.0]);
31 },
32 set numbers(_) {}
33 });
34 num_sign_test.main = function() {
35 for (let number of num_sign_test.numbers) {
36 num_sign_test.test(number);
37 num_sign_test.test(-dart.notNull(number));
38 }
39 };
40 dart.fn(num_sign_test.main, VoidTodynamic());
41 num_sign_test.test = function(number) {
42 let expectSign = num_sign_test.sign(core.num._check(number));
43 let actualSign = core.num._check(dart.dload(number, 'sign'));
44 if (dart.test(expectSign[dartx.isNaN])) {
45 expect$.Expect.isTrue(actualSign[dartx.isNaN], dart.str`${number}: ${actua lSign} != NaN`);
46 } else {
47 if (typeof number == 'number') {
48 expect$.Expect.isTrue(typeof actualSign == 'number', dart.str`${number}. sign is int`);
49 } else {
50 expect$.Expect.isTrue(typeof actualSign == 'number', dart.str`${number}. sign is double`);
51 }
52 expect$.Expect.equals(expectSign, actualSign, dart.str`${number}`);
53 expect$.Expect.equals(dart.dload(number, 'isNegative'), actualSign[dartx.i sNegative], dart.str`${number}:negative`);
54 let renumber = dart.notNull(actualSign) * dart.notNull(core.num._check(dar t.dsend(number, 'abs')));
55 expect$.Expect.equals(number, renumber, dart.str`${number} (sign*abs)`);
56 if (typeof number == 'number') {
57 expect$.Expect.isTrue(typeof renumber == 'number', dart.str`${number} (s ign*abs) is int`);
58 } else {
59 expect$.Expect.isTrue(typeof renumber == 'number', dart.str`${number} (s ign*abs) is double`);
60 }
61 }
62 };
63 dart.fn(num_sign_test.test, dynamicTovoid());
64 // Exports:
65 exports.num_sign_test = num_sign_test;
66 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/num_parse_test_none_multi.js ('k') | test/codegen/expect/corelib/package_resource_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698