OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_set.h" | 6 #include "vm/bit_set.h" |
7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
11 template<intptr_t Size> | 11 template <intptr_t Size> |
12 void TestBitSet() { | 12 void TestBitSet() { |
13 BitSet<Size> set; | 13 BitSet<Size> set; |
14 EXPECT_EQ(-1, set.Last()); | 14 EXPECT_EQ(-1, set.Last()); |
15 for (int i = 0; i < Size; ++i) { | 15 for (int i = 0; i < Size; ++i) { |
16 EXPECT_EQ(false, set.Test(i)); | 16 EXPECT_EQ(false, set.Test(i)); |
17 set.Set(i, true); | 17 set.Set(i, true); |
18 EXPECT_EQ(true, set.Test(i)); | 18 EXPECT_EQ(true, set.Test(i)); |
19 EXPECT_EQ(i, set.Last()); | 19 EXPECT_EQ(i, set.Last()); |
20 for (int j = 0; j < Size; ++j) { | 20 for (int j = 0; j < Size; ++j) { |
21 intptr_t next = set.Next(j); | 21 intptr_t next = set.Next(j); |
(...skipping 20 matching lines...) Expand all Loading... |
42 | 42 |
43 | 43 |
44 TEST_CASE(BitSetBasic) { | 44 TEST_CASE(BitSetBasic) { |
45 TestBitSet<8>(); | 45 TestBitSet<8>(); |
46 TestBitSet<42>(); | 46 TestBitSet<42>(); |
47 TestBitSet<128>(); | 47 TestBitSet<128>(); |
48 TestBitSet<200>(); | 48 TestBitSet<200>(); |
49 } | 49 } |
50 | 50 |
51 } // namespace dart | 51 } // namespace dart |
OLD | NEW |