Index: tests/standalone/bytedata_test.dart |
diff --git a/tests/standalone/bytedata_test.dart b/tests/standalone/bytedata_test.dart |
index 068a9845c6e5299e378791bdd46db47650ef661e..d006ca738397a3da74b84720bb9b9dfcd66026d4 100644 |
--- a/tests/standalone/bytedata_test.dart |
+++ b/tests/standalone/bytedata_test.dart |
@@ -11,8 +11,8 @@ import "package:expect/expect.dart"; |
import 'dart:typed_data'; |
testGetters() { |
- bool host_is_little_endian = |
- (new Uint8List.view(new Uint16List.fromList([1]).buffer))[0] == 1; |
+ bool host_is_little_endian = |
+ (new Uint8List.view(new Uint16List.fromList([1]).buffer))[0] == 1; |
var list = new Uint8List(8); |
list[0] = 0xf1; |
@@ -30,7 +30,7 @@ testGetters() { |
int expected_value_be = -3598; |
int expected_value_le = -3343; |
- value = bd.getInt16(0); // Default is big endian access. |
+ value = bd.getInt16(0); // Default is big endian access. |
Expect.equals(expected_value_be, value); |
value = bd.getInt16(0, Endianness.BIG_ENDIAN); |
Expect.equals(expected_value_be, value); |
@@ -45,7 +45,7 @@ testGetters() { |
Expect.equals(expected_value_be, value); |
} |
- value = bd.getUint16(0); // Default is big endian access. |
+ value = bd.getUint16(0); // Default is big endian access. |
Expect.equals(0xf1f2, value); |
value = bd.getUint16(0, Endianness.BIG_ENDIAN); |
Expect.equals(0xf1f2, value); |
@@ -62,7 +62,7 @@ testGetters() { |
expected_value_be = -235736076; |
expected_value_le = -185339151; |
- value = bd.getInt32(0); // Default is big endian access. |
+ value = bd.getInt32(0); // Default is big endian access. |
Expect.equals(expected_value_be, value); |
value = bd.getInt32(0, Endianness.BIG_ENDIAN); |
Expect.equals(expected_value_be, value); |
@@ -76,7 +76,7 @@ testGetters() { |
Expect.equals(expected_value_be, value); |
} |
- value = bd.getUint32(0); // Default is big endian access. |
+ value = bd.getUint32(0); // Default is big endian access. |
Expect.equals(0xf1f2f3f4, value); |
value = bd.getUint32(0, Endianness.BIG_ENDIAN); |
Expect.equals(0xf1f2f3f4, value); |
@@ -93,7 +93,7 @@ testGetters() { |
expected_value_be = -1012478732780767240; |
expected_value_le = -506664896818842895; |
- value = bd.getInt64(0); // Default is big endian access. |
+ value = bd.getInt64(0); // Default is big endian access. |
Expect.equals(expected_value_be, value); |
value = bd.getInt64(0, Endianness.BIG_ENDIAN); |
Expect.equals(expected_value_be, value); |
@@ -107,7 +107,7 @@ testGetters() { |
Expect.equals(expected_value_be, value); |
} |
- value = bd.getUint64(0); // Default is big endian access. |
+ value = bd.getUint64(0); // Default is big endian access. |
Expect.equals(0xf1f2f3f4f5f6f7f8, value); |
value = bd.getUint64(0, Endianness.BIG_ENDIAN); |
Expect.equals(0xf1f2f3f4f5f6f7f8, value); |
@@ -123,7 +123,7 @@ testGetters() { |
double expected_be_value = -2.4060893954673178e+30; |
double expected_le_value = -1.5462104171572421e+32; |
- value = bd.getFloat32(0); // Default is big endian access. |
+ value = bd.getFloat32(0); // Default is big endian access. |
Expect.equals(expected_be_value, value); |
value = bd.getFloat32(0, Endianness.BIG_ENDIAN); |
Expect.equals(expected_be_value, value); |
@@ -137,10 +137,9 @@ testGetters() { |
Expect.equals(expected_be_value, value); |
} |
- |
expected_be_value = -7.898661740976602e+240; |
expected_le_value = -5.185705956736366e+274; |
- value = bd.getFloat64(0); // Default is big endian access. |
+ value = bd.getFloat64(0); // Default is big endian access. |
Expect.equals(expected_be_value, value); |
value = bd.getFloat64(0, Endianness.BIG_ENDIAN); |
Expect.equals(expected_be_value, value); |
@@ -155,19 +154,16 @@ testGetters() { |
} |
} |
- |
validate16be(var list) { |
Expect.equals(0xf1, list[0]); |
Expect.equals(0xf2, list[1]); |
} |
- |
validate16le(var list) { |
Expect.equals(0xf2, list[0]); |
Expect.equals(0xf1, list[1]); |
} |
- |
validate32be(var list) { |
Expect.equals(0xf1, list[0]); |
Expect.equals(0xf2, list[1]); |
@@ -175,7 +171,6 @@ validate32be(var list) { |
Expect.equals(0xf4, list[3]); |
} |
- |
validate32le(var list) { |
Expect.equals(0xf4, list[0]); |
Expect.equals(0xf3, list[1]); |
@@ -183,7 +178,6 @@ validate32le(var list) { |
Expect.equals(0xf1, list[3]); |
} |
- |
validate64be(var list) { |
Expect.equals(0xf1, list[0]); |
Expect.equals(0xf2, list[1]); |
@@ -195,7 +189,6 @@ validate64be(var list) { |
Expect.equals(0xf8, list[7]); |
} |
- |
validate64le(var list) { |
Expect.equals(0xf8, list[0]); |
Expect.equals(0xf7, list[1]); |
@@ -207,10 +200,9 @@ validate64le(var list) { |
Expect.equals(0xf1, list[7]); |
} |
- |
testSetters() { |
- bool host_is_little_endian = |
- (new Uint8List.view(new Uint16List.fromList([1]).buffer))[0] == 1; |
+ bool host_is_little_endian = |
+ (new Uint8List.view(new Uint16List.fromList([1]).buffer))[0] == 1; |
var list = new Uint8List(8); |
for (int i = 0; i < list.length; i++) { |
@@ -219,7 +211,7 @@ testSetters() { |
var ba = list.buffer; |
ByteData bd = new ByteData.view(ba); |
- bd.setInt16(0, 0xf1f2); // Default is big endian access. |
+ bd.setInt16(0, 0xf1f2); // Default is big endian access. |
validate16be(list); |
bd.setInt16(0, 0xf1f2, Endianness.BIG_ENDIAN); |
validate16be(list); |
@@ -234,7 +226,7 @@ testSetters() { |
validate16be(list); |
} |
- bd.setUint16(0, 0xf1f2); // Default is big endian access. |
+ bd.setUint16(0, 0xf1f2); // Default is big endian access. |
validate16be(list); |
bd.setUint16(0, 0xf1f2, Endianness.BIG_ENDIAN); |
validate16be(list); |
@@ -249,7 +241,7 @@ testSetters() { |
validate16be(list); |
} |
- bd.setInt32(0, 0xf1f2f3f4); // Default is big endian access. |
+ bd.setInt32(0, 0xf1f2f3f4); // Default is big endian access. |
validate32be(list); |
bd.setInt32(0, 0xf1f2f3f4, Endianness.BIG_ENDIAN); |
validate32be(list); |
@@ -264,7 +256,7 @@ testSetters() { |
validate32be(list); |
} |
- bd.setUint32(0, 0xf1f2f3f4); // Default is big endian access. |
+ bd.setUint32(0, 0xf1f2f3f4); // Default is big endian access. |
validate32be(list); |
bd.setUint32(0, 0xf1f2f3f4, Endianness.BIG_ENDIAN); |
validate32be(list); |
@@ -279,7 +271,7 @@ testSetters() { |
validate32be(list); |
} |
- bd.setInt64(0, 0xf1f2f3f4f5f6f7f8); // Default is big endian access. |
+ bd.setInt64(0, 0xf1f2f3f4f5f6f7f8); // Default is big endian access. |
validate64be(list); |
bd.setInt64(0, 0xf1f2f3f4f5f6f7f8, Endianness.BIG_ENDIAN); |
validate64be(list); |
@@ -294,7 +286,7 @@ testSetters() { |
validate64be(list); |
} |
- bd.setUint64(0, 0xf1f2f3f4f5f6f7f8); // Default is big endian access. |
+ bd.setUint64(0, 0xf1f2f3f4f5f6f7f8); // Default is big endian access. |
validate64be(list); |
bd.setUint64(0, 0xf1f2f3f4f5f6f7f8, Endianness.BIG_ENDIAN); |
validate64be(list); |
@@ -309,7 +301,7 @@ testSetters() { |
validate64be(list); |
} |
- bd.setFloat32(0, -2.4060893954673178e+30); // Default is big endian access. |
+ bd.setFloat32(0, -2.4060893954673178e+30); // Default is big endian access. |
validate32be(list); |
bd.setFloat32(0, -2.4060893954673178e+30, Endianness.BIG_ENDIAN); |
validate32be(list); |
@@ -324,7 +316,7 @@ testSetters() { |
validate32be(list); |
} |
- bd.setFloat64(0, -7.898661740976602e+240); // Default is big endian access. |
+ bd.setFloat64(0, -7.898661740976602e+240); // Default is big endian access. |
validate64be(list); |
bd.setFloat64(0, -7.898661740976602e+240, Endianness.BIG_ENDIAN); |
validate64be(list); |
@@ -338,10 +330,8 @@ testSetters() { |
Expect.isTrue(identical(Endianness.HOST_ENDIAN, Endianness.BIG_ENDIAN)); |
validate64be(list); |
} |
- |
} |
- |
main() { |
testGetters(); |
testSetters(); |