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

Side by Side Diff: vm/bit_vector_test.cc

Issue 10539108: First step to SSA construction: Phi insertion. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: addressed comments, fixed bug in BitVector::Contains Created 8 years, 6 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
« no previous file with comments | « vm/bit_vector.h ('k') | vm/flow_graph_builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/bit_vector.h" 6 #include "vm/bit_vector.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
11 TEST_CASE(BitVector) { 11 TEST_CASE(BitVector) {
12 { BitVector* v = new BitVector(15); 12 { BitVector* v = new BitVector(15);
13 v->Add(1); 13 v->Add(1);
14 EXPECT_EQ(true, v->Contains(1));
15 EXPECT_EQ(false, v->Contains(0));
14 { BitVector::Iterator iter(v); 16 { BitVector::Iterator iter(v);
15 EXPECT_EQ(1, iter.Current()); 17 EXPECT_EQ(1, iter.Current());
16 iter.Advance(); 18 iter.Advance();
17 EXPECT(iter.Done()); 19 EXPECT(iter.Done());
18 } 20 }
19 v->Add(0); 21 v->Add(0);
20 v->Add(1); 22 v->Add(1);
23 EXPECT_EQ(true, v->Contains(0));
24 EXPECT_EQ(true, v->Contains(1));
21 { BitVector::Iterator iter(v); 25 { BitVector::Iterator iter(v);
22 EXPECT_EQ(0, iter.Current()); 26 EXPECT_EQ(0, iter.Current());
23 iter.Advance(); 27 iter.Advance();
24 EXPECT_EQ(1, iter.Current()); 28 EXPECT_EQ(1, iter.Current());
25 iter.Advance(); 29 iter.Advance();
26 EXPECT(iter.Done()); 30 EXPECT(iter.Done());
27 } 31 }
28 } 32 }
29 33
30 { BitVector* v = new BitVector(128); 34 { BitVector* v = new BitVector(128);
31 v->Add(49); 35 v->Add(49);
32 v->Add(62); 36 v->Add(62);
33 v->Add(63); 37 v->Add(63);
34 v->Add(65); 38 v->Add(65);
39 EXPECT_EQ(true, v->Contains(49));
40 EXPECT_EQ(true, v->Contains(62));
41 EXPECT_EQ(true, v->Contains(63));
42 EXPECT_EQ(true, v->Contains(65));
43 EXPECT_EQ(false, v->Contains(64));
35 BitVector::Iterator iter(v); 44 BitVector::Iterator iter(v);
36 EXPECT_EQ(49, iter.Current()); 45 EXPECT_EQ(49, iter.Current());
37 iter.Advance(); 46 iter.Advance();
38 EXPECT_EQ(62, iter.Current()); 47 EXPECT_EQ(62, iter.Current());
39 iter.Advance(); 48 iter.Advance();
40 EXPECT_EQ(63, iter.Current()); 49 EXPECT_EQ(63, iter.Current());
41 iter.Advance(); 50 iter.Advance();
42 EXPECT_EQ(65, iter.Current()); 51 EXPECT_EQ(65, iter.Current());
43 iter.Advance(); 52 iter.Advance();
44 EXPECT(iter.Done()); 53 EXPECT(iter.Done());
45 } 54 }
46 } 55 }
47 56
48 } // namespace dart 57 } // namespace dart
OLDNEW
« no previous file with comments | « vm/bit_vector.h ('k') | vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698