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

Side by Side Diff: pkg/analyzer/test/src/summary/flat_buffers_test.dart

Issue 1685263003: Minor improvements to list representation in flatbuffers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add a test Created 4 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | pkg/analyzer/tool/summary/generate.dart » ('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) 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:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // read and verify 139 // read and verify
140 BufferPointer object = new BufferPointer.fromBytes(byteList).derefObject(); 140 BufferPointer object = new BufferPointer.fromBytes(byteList).derefObject();
141 expect(const BoolReader().vTableGet(object, 0), true); 141 expect(const BoolReader().vTableGet(object, 0), true);
142 expect(const Int8Reader().vTableGet(object, 1), 10); 142 expect(const Int8Reader().vTableGet(object, 1), 10);
143 expect(const Int32Reader().vTableGet(object, 2), 20); 143 expect(const Int32Reader().vTableGet(object, 2), 20);
144 expect(const StringReader().vTableGet(object, 3), '12345'); 144 expect(const StringReader().vTableGet(object, 3), '12345');
145 expect(const Int32Reader().vTableGet(object, 4), 40); 145 expect(const Int32Reader().vTableGet(object, 4), 40);
146 expect(const Uint32Reader().vTableGet(object, 5), 0x9ABCDEF0); 146 expect(const Uint32Reader().vTableGet(object, 5), 0x9ABCDEF0);
147 } 147 }
148 148
149 void test_writeList_of_Uint32() {
150 List<int> values = <int>[10, 100, 12345, 0x9abcdef0];
151 // write
152 List<int> byteList;
153 {
154 Builder builder = new Builder(initialSize: 0);
155 Offset offset = builder.writeListUint32(values);
156 byteList = builder.finish(offset);
157 }
158 // read and verify
159 BufferPointer root = new BufferPointer.fromBytes(byteList);
160 List<int> items = const Uint32ListReader().read(root);
161 expect(items, hasLength(4));
162 expect(items, orderedEquals(values));
163 }
164
149 void test_writeList_ofFloat64() { 165 void test_writeList_ofFloat64() {
150 List<double> values = <double>[-1.234567, 3.4E+9, -5.6E-13, 7.8, 12.13]; 166 List<double> values = <double>[-1.234567, 3.4E+9, -5.6E-13, 7.8, 12.13];
151 // write 167 // write
152 List<int> byteList; 168 List<int> byteList;
153 { 169 {
154 Builder builder = new Builder(initialSize: 0); 170 Builder builder = new Builder(initialSize: 0);
155 Offset offset = builder.writeListFloat64(values); 171 Offset offset = builder.writeListFloat64(values);
156 byteList = builder.finish(offset); 172 byteList = builder.finish(offset);
157 } 173 }
158 // read and verify 174 // read and verify
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 309 }
294 310
295 class TestPointReader extends TableReader<TestPointImpl> { 311 class TestPointReader extends TableReader<TestPointImpl> {
296 const TestPointReader(); 312 const TestPointReader();
297 313
298 @override 314 @override
299 TestPointImpl createObject(BufferPointer object) { 315 TestPointImpl createObject(BufferPointer object) {
300 return new TestPointImpl(object); 316 return new TestPointImpl(object);
301 } 317 }
302 } 318 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | pkg/analyzer/tool/summary/generate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698