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

Side by Side Diff: test/codegen/expect/language/instanceof_optimized_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('language/instanceof_optimized_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__instanceof_optimized_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect;
10 const instanceof_optimized_test = Object.create(null);
11 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT ype(core.bool, [dart.dynamic])))();
12 let dynamicToint = () => (dynamicToint = dart.constFn(dart.definiteFunctionTyp e(core.int, [dart.dynamic])))();
13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
14 instanceof_optimized_test.isInt = function(x) {
15 return typeof x == 'number';
16 };
17 dart.fn(instanceof_optimized_test.isInt, dynamicTobool());
18 instanceof_optimized_test.isIntRes = function(x) {
19 if (typeof x == 'number') {
20 return 1;
21 } else {
22 return 0;
23 }
24 };
25 dart.fn(instanceof_optimized_test.isIntRes, dynamicToint());
26 instanceof_optimized_test.isNotIntRes = function(x) {
27 if (!(typeof x == 'number')) {
28 return 1;
29 } else {
30 return 0;
31 }
32 };
33 dart.fn(instanceof_optimized_test.isNotIntRes, dynamicToint());
34 instanceof_optimized_test.isIfThenElseIntRes = function(x) {
35 return typeof x == 'number' ? 1 : 0;
36 };
37 dart.fn(instanceof_optimized_test.isIfThenElseIntRes, dynamicToint());
38 instanceof_optimized_test.isString = function(x) {
39 return typeof x == 'string';
40 };
41 dart.fn(instanceof_optimized_test.isString, dynamicTobool());
42 instanceof_optimized_test.isStringRes = function(x) {
43 if (typeof x == 'string') {
44 return 1;
45 } else {
46 return 0;
47 }
48 };
49 dart.fn(instanceof_optimized_test.isStringRes, dynamicToint());
50 instanceof_optimized_test.isNotStringRes = function(x) {
51 if (!(typeof x == 'string')) {
52 return 1;
53 } else {
54 return 0;
55 }
56 };
57 dart.fn(instanceof_optimized_test.isNotStringRes, dynamicToint());
58 instanceof_optimized_test.main = function() {
59 for (let i = 0; i < 20; i++) {
60 expect$.Expect.isFalse(instanceof_optimized_test.isInt(3.2));
61 expect$.Expect.isTrue(instanceof_optimized_test.isInt(3));
62 expect$.Expect.isTrue(instanceof_optimized_test.isInt(17179869184));
63 expect$.Expect.isFalse(instanceof_optimized_test.isString(2.0));
64 expect$.Expect.isTrue(instanceof_optimized_test.isString("Morgan"));
65 }
66 expect$.Expect.isFalse(instanceof_optimized_test.isString(true));
67 for (let i = 0; i < 20; i++) {
68 expect$.Expect.isFalse(instanceof_optimized_test.isInt(3.2));
69 expect$.Expect.isTrue(instanceof_optimized_test.isInt(3));
70 expect$.Expect.isTrue(instanceof_optimized_test.isInt(17179869184));
71 expect$.Expect.isFalse(instanceof_optimized_test.isInt("hu"));
72 expect$.Expect.isFalse(instanceof_optimized_test.isString(2.0));
73 expect$.Expect.isTrue(instanceof_optimized_test.isString("Morgan"));
74 expect$.Expect.isFalse(instanceof_optimized_test.isString(true));
75 }
76 for (let i = 0; i < 20; i++) {
77 expect$.Expect.equals(0, instanceof_optimized_test.isIntRes(3.2));
78 expect$.Expect.equals(1, instanceof_optimized_test.isIntRes(3));
79 expect$.Expect.equals(0, instanceof_optimized_test.isIntRes("hi"));
80 expect$.Expect.equals(1, instanceof_optimized_test.isNotIntRes(3.2));
81 expect$.Expect.equals(0, instanceof_optimized_test.isNotIntRes(3));
82 expect$.Expect.equals(1, instanceof_optimized_test.isNotIntRes("hi"));
83 expect$.Expect.equals(0, instanceof_optimized_test.isIfThenElseIntRes(3.2) );
84 expect$.Expect.equals(1, instanceof_optimized_test.isIfThenElseIntRes(3));
85 expect$.Expect.equals(0, instanceof_optimized_test.isIfThenElseIntRes("hi" ));
86 }
87 for (let i = 0; i < 20; i++) {
88 expect$.Expect.equals(0, instanceof_optimized_test.isStringRes(3.2));
89 expect$.Expect.equals(1, instanceof_optimized_test.isStringRes("Lotus"));
90 expect$.Expect.equals(1, instanceof_optimized_test.isNotStringRes(3.2));
91 expect$.Expect.equals(0, instanceof_optimized_test.isNotStringRes("Lotus") );
92 }
93 expect$.Expect.equals(0, instanceof_optimized_test.isStringRes(null));
94 expect$.Expect.equals(1, instanceof_optimized_test.isNotIntRes(null));
95 for (let i = 0; i < 20; i++) {
96 expect$.Expect.equals(0, instanceof_optimized_test.isStringRes(3.2));
97 expect$.Expect.equals(1, instanceof_optimized_test.isStringRes("Lotus"));
98 expect$.Expect.equals(0, instanceof_optimized_test.isStringRes(null));
99 expect$.Expect.equals(1, instanceof_optimized_test.isNotStringRes(3.2));
100 expect$.Expect.equals(0, instanceof_optimized_test.isNotStringRes("Lotus") );
101 expect$.Expect.equals(1, instanceof_optimized_test.isNotStringRes(null));
102 }
103 };
104 dart.fn(instanceof_optimized_test.main, VoidTodynamic());
105 // Exports:
106 exports.instanceof_optimized_test = instanceof_optimized_test;
107 });
OLDNEW
« no previous file with comments | « test/codegen/expect/language/instanceof4_test_none_multi.js ('k') | test/codegen/expect/language/instanceof_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698