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

Side by Side Diff: test/codegen/expect/corelib/maps_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/maps_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__maps_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const collection = dart_sdk.collection;
8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect;
11 const maps_test = Object.create(null);
12 let dynamicAnddynamicTovoid = () => (dynamicAnddynamicTovoid = dart.constFn(da rt.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
13 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
14 let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core .int, [])))();
15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
16 maps_test.main = function() {
17 let key1 = "key1";
18 let key2 = "key2";
19 let key3 = "key3";
20 let key4 = "key4";
21 let key5 = "key5";
22 let key6 = "key6";
23 let key7 = "key7";
24 let key8 = "key8";
25 let value1 = 10;
26 let value2 = 20;
27 let value3 = 30;
28 let value4 = 40;
29 let value5 = 50;
30 let value6 = 60;
31 let value7 = 70;
32 let value8 = 80;
33 let map = core.Map.new();
34 map[dartx.set](key1, value1);
35 map[dartx.set](key1, value2);
36 expect$.Expect.equals(false, collection.Maps.containsKey(map, key2));
37 expect$.Expect.equals(1, collection.Maps.length(map));
38 map[dartx.set](key1, value1);
39 map[dartx.set](key2, value2);
40 expect$.Expect.equals(2, collection.Maps.length(map));
41 map[dartx.set](key3, value3);
42 map[dartx.set](key4, value4);
43 map[dartx.set](key5, value5);
44 map[dartx.set](key6, value6);
45 map[dartx.set](key7, value7);
46 map[dartx.set](key8, value8);
47 expect$.Expect.equals(8, collection.Maps.length(map));
48 map[dartx.remove](key4);
49 expect$.Expect.equals(false, collection.Maps.containsKey(map, key4));
50 expect$.Expect.equals(7, collection.Maps.length(map));
51 collection.Maps.clear(map);
52 expect$.Expect.equals(0, collection.Maps.length(map));
53 expect$.Expect.equals(false, collection.Maps.containsKey(map, key1));
54 expect$.Expect.equals(false, map[dartx.containsKey](key1));
55 expect$.Expect.equals(false, collection.Maps.containsKey(map, key2));
56 expect$.Expect.equals(false, map[dartx.containsKey](key2));
57 expect$.Expect.equals(false, collection.Maps.containsKey(map, key3));
58 expect$.Expect.equals(false, map[dartx.containsKey](key3));
59 expect$.Expect.equals(false, collection.Maps.containsKey(map, key4));
60 expect$.Expect.equals(false, map[dartx.containsKey](key4));
61 expect$.Expect.equals(false, collection.Maps.containsKey(map, key5));
62 expect$.Expect.equals(false, map[dartx.containsKey](key5));
63 expect$.Expect.equals(false, collection.Maps.containsKey(map, key6));
64 expect$.Expect.equals(false, map[dartx.containsKey](key6));
65 expect$.Expect.equals(false, collection.Maps.containsKey(map, key7));
66 expect$.Expect.equals(false, map[dartx.containsKey](key7));
67 expect$.Expect.equals(false, collection.Maps.containsKey(map, key8));
68 expect$.Expect.equals(false, map[dartx.containsKey](key8));
69 map[dartx.set](key1, value1);
70 expect$.Expect.equals(1, collection.Maps.length(map));
71 map[dartx.set](key2, value2);
72 expect$.Expect.equals(2, collection.Maps.length(map));
73 map[dartx.set](key3, value3);
74 map[dartx.remove](key3);
75 expect$.Expect.equals(2, collection.Maps.length(map));
76 map[dartx.set](key4, value4);
77 map[dartx.remove](key4);
78 expect$.Expect.equals(2, collection.Maps.length(map));
79 map[dartx.set](key5, value5);
80 map[dartx.remove](key5);
81 expect$.Expect.equals(2, collection.Maps.length(map));
82 map[dartx.set](key6, value6);
83 map[dartx.remove](key6);
84 expect$.Expect.equals(2, collection.Maps.length(map));
85 map[dartx.set](key7, value7);
86 map[dartx.remove](key7);
87 expect$.Expect.equals(2, collection.Maps.length(map));
88 map[dartx.set](key8, value8);
89 map[dartx.remove](key8);
90 expect$.Expect.equals(2, collection.Maps.length(map));
91 expect$.Expect.equals(true, collection.Maps.containsKey(map, key1));
92 expect$.Expect.equals(true, collection.Maps.containsValue(map, value1));
93 let other_map = core.Map.new();
94 function testForEachMap(key, value) {
95 other_map[dartx.set](key, value);
96 }
97 dart.fn(testForEachMap, dynamicAnddynamicTovoid());
98 collection.Maps.forEach(map, testForEachMap);
99 expect$.Expect.equals(true, other_map[dartx.containsKey](key1));
100 expect$.Expect.equals(true, other_map[dartx.containsKey](key2));
101 expect$.Expect.equals(true, other_map[dartx.containsValue](value1));
102 expect$.Expect.equals(true, other_map[dartx.containsValue](value2));
103 expect$.Expect.equals(2, collection.Maps.length(other_map));
104 function testForEachCollection(value) {
105 other_map[dartx.set](value, value);
106 }
107 dart.fn(testForEachCollection, dynamicTovoid());
108 let values = collection.Maps.getValues(map);
109 other_map = core.Map.new();
110 values[dartx.forEach](testForEachCollection);
111 expect$.Expect.equals(true, !dart.test(other_map[dartx.containsKey](key1)));
112 expect$.Expect.equals(true, !dart.test(other_map[dartx.containsKey](key2)));
113 expect$.Expect.equals(true, !dart.test(other_map[dartx.containsValue](key1)) );
114 expect$.Expect.equals(true, !dart.test(other_map[dartx.containsValue](key2)) );
115 expect$.Expect.equals(true, other_map[dartx.containsKey](value1));
116 expect$.Expect.equals(true, other_map[dartx.containsKey](value2));
117 expect$.Expect.equals(true, other_map[dartx.containsValue](value1));
118 expect$.Expect.equals(true, other_map[dartx.containsValue](value2));
119 expect$.Expect.equals(2, other_map[dartx.length]);
120 other_map[dartx.clear]();
121 map[dartx.clear]();
122 expect$.Expect.equals(false, collection.Maps.containsKey(map, key1));
123 collection.Maps.putIfAbsent(map, key1, dart.fn(() => 10, VoidToint()));
124 expect$.Expect.equals(true, map[dartx.containsKey](key1));
125 expect$.Expect.equals(10, map[dartx.get](key1));
126 expect$.Expect.equals(10, collection.Maps.putIfAbsent(map, key1, dart.fn(() => 11, VoidToint())));
127 };
128 dart.fn(maps_test.main, VoidTodynamic());
129 // Exports:
130 exports.maps_test = maps_test;
131 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/map_values_test.js ('k') | test/codegen/expect/corelib/nan_infinity_test_01_multi.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698