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

Side by Side Diff: vm/bitmap_test.cc

Issue 10025003: Revert change 6302 until the compiler warning is addressed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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/bitmap.cc ('k') | vm/code_descriptors.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/bitmap.h" 6 #include "vm/bitmap.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 19 matching lines...) Expand all
30 for (int32_t i = 0; i < 1024; i++) { 30 for (int32_t i = 0; i < 1024; i++) {
31 bmap1_builder->Set(i, value); 31 bmap1_builder->Set(i, value);
32 value = !value; 32 value = !value;
33 } 33 }
34 value = true; 34 value = true;
35 for (int32_t i = 0; i < 1024; i++) { 35 for (int32_t i = 0; i < 1024; i++) {
36 EXPECT_EQ(value, bmap1_builder->Get(i)); 36 EXPECT_EQ(value, bmap1_builder->Get(i));
37 value = !value; 37 value = !value;
38 } 38 }
39 // Create a Bitmap object from the builder and verify it's contents. 39 // Create a Bitmap object from the builder and verify it's contents.
40 const Stackmap& bmap1 = Stackmap::Handle(Stackmap::New(0, bmap1_builder)); 40 const Stackmap& bmap1 = Stackmap::Handle(
41 Stackmap::New(0, Code::Handle(), bmap1_builder));
41 EXPECT_EQ(1022, bmap1_builder->Maximum()); 42 EXPECT_EQ(1022, bmap1_builder->Maximum());
42 EXPECT_EQ(0, bmap1_builder->Minimum()); 43 EXPECT_EQ(0, bmap1_builder->Minimum());
43 OS::Print("%s\n", bmap1.ToCString()); 44 OS::Print("%s\n", bmap1.ToCString());
44 value = true; 45 value = true;
45 for (int32_t i = 0; i < 1024; i++) { 46 for (int32_t i = 0; i < 1024; i++) {
46 EXPECT_EQ(value, bmap1.IsObject(i)); 47 EXPECT_EQ(value, bmap1.IsObject(i));
47 value = !value; 48 value = !value;
48 } 49 }
49 EXPECT(!bmap1.IsObject(2056)); // Out of range so returns false. 50 EXPECT(!bmap1.IsObject(2056)); // Out of range so returns false.
50 51
51 // Test the SetRange function in the builder. 52 // Test the SetRange function in the builder.
52 bmap1_builder->SetRange(0, 256, false); 53 bmap1_builder->SetRange(0, 256, false);
53 bmap1_builder->SetRange(257, 1024, true); 54 bmap1_builder->SetRange(257, 1024, true);
54 bmap1_builder->SetRange(1025, 2048, false); 55 bmap1_builder->SetRange(1025, 2048, false);
55 for (int32_t i = 0; i <= 256; i++) { 56 for (int32_t i = 0; i <= 256; i++) {
56 EXPECT(!bmap1_builder->Get(i)); 57 EXPECT(!bmap1_builder->Get(i));
57 } 58 }
58 for (int32_t i = 257; i <= 1024; i++) { 59 for (int32_t i = 257; i <= 1024; i++) {
59 EXPECT(bmap1_builder->Get(i)); 60 EXPECT(bmap1_builder->Get(i));
60 } 61 }
61 for (int32_t i = 1025; i <= 2048; i++) { 62 for (int32_t i = 1025; i <= 2048; i++) {
62 EXPECT(!bmap1_builder->Get(i)); 63 EXPECT(!bmap1_builder->Get(i));
63 } 64 }
64 const Stackmap& bmap2 = Stackmap::Handle(Stackmap::New(0, bmap1_builder)); 65 const Stackmap& bmap2 = Stackmap::Handle(
66 Stackmap::New(0, Code::Handle(), bmap1_builder));
65 EXPECT_EQ(1024, bmap1_builder->Maximum()); 67 EXPECT_EQ(1024, bmap1_builder->Maximum());
66 EXPECT_EQ(257, bmap1_builder->Minimum()); 68 EXPECT_EQ(257, bmap1_builder->Minimum());
67 for (int32_t i = 0; i <= 256; i++) { 69 for (int32_t i = 0; i <= 256; i++) {
68 EXPECT(!bmap2.IsObject(i)); 70 EXPECT(!bmap2.IsObject(i));
69 } 71 }
70 for (int32_t i = 257; i <= 1024; i++) { 72 for (int32_t i = 257; i <= 1024; i++) {
71 EXPECT(bmap2.IsObject(i)); 73 EXPECT(bmap2.IsObject(i));
72 } 74 }
73 for (int32_t i = 1025; i <= 2048; i++) { 75 for (int32_t i = 1025; i <= 2048; i++) {
74 EXPECT(!bmap2.IsObject(i)); 76 EXPECT(!bmap2.IsObject(i));
(...skipping 19 matching lines...) Expand all
94 } 96 }
95 for (int32_t i = 257; i <= 1024; i++) { 97 for (int32_t i = 257; i <= 1024; i++) {
96 EXPECT(bmap3_builder->Get(i)); 98 EXPECT(bmap3_builder->Get(i));
97 } 99 }
98 for (int32_t i = 1025; i <= 2048; i++) { 100 for (int32_t i = 1025; i <= 2048; i++) {
99 EXPECT(!bmap3_builder->Get(i)); 101 EXPECT(!bmap3_builder->Get(i));
100 } 102 }
101 } 103 }
102 104
103 } // namespace dart 105 } // namespace dart
OLDNEW
« no previous file with comments | « vm/bitmap.cc ('k') | vm/code_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698