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

Unified Diff: test/test_util.dart

Issue 25708003: Update the protocol buffer compiler plugin to use Int64 from the fixnum package (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: test/test_util.dart
diff --git a/test/test_util.dart b/test/test_util.dart
index a708e613aac707828007b214b190738745e9c8cc..6f6c391da36b530293eca3be37707c63f8bd84d4 100644
--- a/test/test_util.dart
+++ b/test/test_util.dart
@@ -6,6 +6,7 @@ library test_util;
import 'dart:typed_data';
+import 'package:fixnum/fixnum.dart';
import 'package:protobuf/protobuf.dart';
import 'package:unittest/unittest.dart';
@@ -13,20 +14,14 @@ import '../out/protos/google/protobuf/unittest_import.pb.dart';
import '../out/protos/google/protobuf/unittest.pb.dart';
-make64(lo, [hi = null]) {
+Int64 make64(lo, [hi = null]) {
if (hi == null) hi = lo < 0 ? -1 : 0;
- return new ByteData(8)
- ..setUint32(0, lo, Endianness.LITTLE_ENDIAN)
- ..setUint32(4, hi, Endianness.LITTLE_ENDIAN);
+ return new Int64.fromInts(hi, lo);
}
expect64(lo, [hi = null]) {
- final expected = make64(lo, hi);
- return predicate((actual) {
- get(data, offset) => data.getUint32(offset, Endianness.LITTLE_ENDIAN);
- return get(actual, 0) == get(expected, 0) &&
- get(actual, 4) == get(expected, 4);
- });
+ final Int64 expected = make64(lo, hi);
+ return predicate((Int64 actual) => actual == expected);
}
void assertAllExtensionsSet(TestAllExtensions message) {
« pubspec.yaml ('K') | « test/json_test.dart ('k') | test/unknown_field_set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698