Flutter Engine
The Flutter Engine
bit_set_test.cc
Go to the documentation of this 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
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/bit_set.h"
6#include "platform/assert.h"
7#include "vm/unit_test.h"
8
9namespace dart {
10
11template <intptr_t Size>
12void TestBitSet() {
14 EXPECT_EQ(-1, set.Last());
15 for (int i = 0; i < Size; ++i) {
16 EXPECT_EQ(false, set.Test(i));
17 set.Set(i, true);
18 EXPECT_EQ(true, set.Test(i));
19 EXPECT_EQ(i, set.Last());
20 for (int j = 0; j < Size; ++j) {
21 intptr_t next = set.Next(j);
22 if (j <= i) {
23 EXPECT_EQ(i, next);
24 } else {
25 EXPECT_EQ(-1, next);
26 }
27 }
28 set.Set(i, false);
29 EXPECT_EQ(false, set.Test(i));
30 }
31 set.Reset();
32 for (int i = 0; i < Size - 1; ++i) {
33 set.Set(i, true);
34 for (int j = i + 1; j < Size; ++j) {
35 set.Set(j, true);
36 EXPECT_EQ(j, set.Last());
37 EXPECT_EQ(i, set.ClearLastAndFindPrevious(j));
38 EXPECT_EQ(false, set.Test(j));
39 }
40 }
41}
42
43TEST_CASE(BitSetBasic) {
44 TestBitSet<8>();
45 TestBitSet<42>();
46 TestBitSet<128>();
47 TestBitSet<200>();
48}
49
50} // namespace dart
static float next(float f)
Definition: dart_vm.cc:33
void TestBitSet()
Definition: bit_set_test.cc:12
TEST_CASE(DirectoryCurrent)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76
TSize< Scalar > Size
Definition: size.h:137