| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library test.src.summary.flat_buffers_test; | 5 library test.src.summary.flat_buffers_test; |
| 6 | 6 |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/summary/flat_buffers.dart'; | 9 import 'package:analyzer/src/summary/flat_buffers.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 11 | 12 |
| 12 import '../../reflective_tests.dart'; | |
| 13 | |
| 14 main() { | 13 main() { |
| 15 groupSep = ' | '; | 14 groupSep = ' | '; |
| 16 runReflectiveTests(BuilderTest); | 15 defineReflectiveTests(BuilderTest); |
| 17 } | 16 } |
| 18 | 17 |
| 19 @reflectiveTest | 18 @reflectiveTest |
| 20 class BuilderTest { | 19 class BuilderTest { |
| 21 void test_error_addInt32_withoutStartTable() { | 20 void test_error_addInt32_withoutStartTable() { |
| 22 Builder builder = new Builder(); | 21 Builder builder = new Builder(); |
| 23 expect(() { | 22 expect(() { |
| 24 builder.addInt32(0, 0); | 23 builder.addInt32(0, 0); |
| 25 }, throwsStateError); | 24 }, throwsStateError); |
| 26 } | 25 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 byteList = builder.finish(offset); | 228 byteList = builder.finish(offset); |
| 230 } | 229 } |
| 231 // read and verify | 230 // read and verify |
| 232 BufferContext buf = new BufferContext.fromBytes(byteList); | 231 BufferContext buf = new BufferContext.fromBytes(byteList); |
| 233 List<bool> items = const BoolListReader().read(buf, 0); | 232 List<bool> items = const BoolListReader().read(buf, 0); |
| 234 expect(items, hasLength(len)); | 233 expect(items, hasLength(len)); |
| 235 for (int i = 0; i < items.length; i++) { | 234 for (int i = 0; i < items.length; i++) { |
| 236 expect(items[i], trueBits.contains(i), reason: 'bit $i of $len'); | 235 expect(items[i], trueBits.contains(i), reason: 'bit $i of $len'); |
| 237 } | 236 } |
| 238 } | 237 } |
| 238 |
| 239 verifyListBooleans(0, <int>[]); | 239 verifyListBooleans(0, <int>[]); |
| 240 verifyListBooleans(1, <int>[]); | 240 verifyListBooleans(1, <int>[]); |
| 241 verifyListBooleans(1, <int>[0]); | 241 verifyListBooleans(1, <int>[0]); |
| 242 verifyListBooleans(31, <int>[0, 1]); | 242 verifyListBooleans(31, <int>[0, 1]); |
| 243 verifyListBooleans(31, <int>[1, 2, 24, 25, 30]); | 243 verifyListBooleans(31, <int>[1, 2, 24, 25, 30]); |
| 244 verifyListBooleans(31, <int>[0, 30]); | 244 verifyListBooleans(31, <int>[0, 30]); |
| 245 verifyListBooleans(32, <int>[1, 2, 24, 25, 31]); | 245 verifyListBooleans(32, <int>[1, 2, 24, 25, 31]); |
| 246 verifyListBooleans(33, <int>[1, 2, 24, 25, 32]); | 246 verifyListBooleans(33, <int>[1, 2, 24, 25, 32]); |
| 247 verifyListBooleans(33, <int>[1, 2, 24, 25, 31, 32]); | 247 verifyListBooleans(33, <int>[1, 2, 24, 25, 31, 32]); |
| 248 verifyListBooleans(63, <int>[]); | 248 verifyListBooleans(63, <int>[]); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 419 } |
| 420 | 420 |
| 421 class TestPointReader extends TableReader<TestPointImpl> { | 421 class TestPointReader extends TableReader<TestPointImpl> { |
| 422 const TestPointReader(); | 422 const TestPointReader(); |
| 423 | 423 |
| 424 @override | 424 @override |
| 425 TestPointImpl createObject(BufferContext object, int offset) { | 425 TestPointImpl createObject(BufferContext object, int offset) { |
| 426 return new TestPointImpl(object, offset); | 426 return new TestPointImpl(object, offset); |
| 427 } | 427 } |
| 428 } | 428 } |
| OLD | NEW |