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

Unified Diff: tests/standalone/typed_data_test.dart

Issue 14332002: Add endian parameter to the get/set functions in ByteData. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/typed_data_test.dart
===================================================================
--- tests/standalone/typed_data_test.dart (revision 21661)
+++ tests/standalone/typed_data_test.dart (working copy)
@@ -189,18 +189,22 @@
Expect.equals(42, bdata.getInt8(i));
}
for (int i = 0; i < bdata.lengthInBytes-1; i+=2) {
- Expect.equals(10794, bdata.getUint16(i));
- Expect.equals(10794, bdata.getInt16(i));
+ Expect.equals(10794, bdata.getUint16(i, Endianness.LITTLE_ENDIAN));
+ Expect.equals(10794, bdata.getInt16(i, Endianness.LITTLE_ENDIAN));
}
for (int i = 0; i < bdata.lengthInBytes-3; i+=4) {
- Expect.equals(707406378, bdata.getUint32(i));
- Expect.equals(707406378, bdata.getInt32(i));
- Expect.equals(1.511366173271439e-13, bdata.getFloat32(i));
+ Expect.equals(707406378, bdata.getUint32(i, Endianness.LITTLE_ENDIAN));
+ Expect.equals(707406378, bdata.getInt32(i, Endianness.LITTLE_ENDIAN));
+ Expect.equals(1.511366173271439e-13,
+ bdata.getFloat32(i, Endianness.LITTLE_ENDIAN));
}
for (int i = 0; i < bdata.lengthInBytes-7; i+=8) {
- Expect.equals(3038287259199220266, bdata.getUint64(i));
- Expect.equals(3038287259199220266, bdata.getInt64(i));
- Expect.equals(1.4260258159703532e-105, bdata.getFloat64(i));
+ Expect.equals(3038287259199220266,
+ bdata.getUint64(i, Endianness.LITTLE_ENDIAN));
+ Expect.equals(3038287259199220266,
+ bdata.getInt64(i, Endianness.LITTLE_ENDIAN));
+ Expect.equals(1.4260258159703532e-105,
+ bdata.getFloat64(i, Endianness.LITTLE_ENDIAN));
}
}
@@ -213,33 +217,44 @@
}
}
var bdata = new ByteData.view(list.buffer);
- for (int i = 0; i < bdata.lengthInBytes; i++) bdata.setUint8(i, 42);
+ for (int i = 0; i < bdata.lengthInBytes; i++) {
+ bdata.setUint8(i, 42);
+ }
validate();
- for (int i = 0; i < bdata.lengthInBytes; i++) bdata.setInt8(i, 42);
+ for (int i = 0; i < bdata.lengthInBytes; i++) {
+ bdata.setInt8(i, 42);
+ }
validate();
- for (int i = 0; i < bdata.lengthInBytes-1; i+=2) bdata.setUint16(i, 10794);
+ for (int i = 0; i < bdata.lengthInBytes-1; i+=2) {
+ bdata.setUint16(i, 10794, Endianness.LITTLE_ENDIAN);
+ }
validate();
- for (int i = 0; i < bdata.lengthInBytes-1; i+=2) bdata.setInt16(i, 10794);
+ for (int i = 0; i < bdata.lengthInBytes-1; i+=2) {
+ bdata.setInt16(i, 10794, Endianness.LITTLE_ENDIAN);
+ }
validate();
- for (int i = 0; i < bdata.lengthInBytes-3; i+=4)
- bdata.setUint32(i, 707406378);
+ for (int i = 0; i < bdata.lengthInBytes-3; i+=4) {
+ bdata.setUint32(i, 707406378, Endianness.LITTLE_ENDIAN);
+ }
validate();
- for (int i = 0; i < bdata.lengthInBytes-3; i+=4) bdata.setInt32(i, 707406378);
+ for (int i = 0; i < bdata.lengthInBytes-3; i+=4) {
+ bdata.setInt32(i, 707406378, Endianness.LITTLE_ENDIAN);
+ }
validate();
for (int i = 0; i < bdata.lengthInBytes-3; i+=4) {
- bdata.setFloat32(i, 1.511366173271439e-13);
+ bdata.setFloat32(i, 1.511366173271439e-13, Endianness.LITTLE_ENDIAN);
}
validate();
for (int i = 0; i < bdata.lengthInBytes-7; i+=8) {
- bdata.setUint64(i, 3038287259199220266);
+ bdata.setUint64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN);
}
validate();
for (int i = 0; i < bdata.lengthInBytes-7; i+=8) {
- bdata.setInt64(i, 3038287259199220266);
+ bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN);
}
validate();
for (int i = 0; i < bdata.lengthInBytes-7; i+=8) {
- bdata.setFloat64(i, 1.4260258159703532e-105);
+ bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN);
}
validate(false);
}

Powered by Google App Engine
This is Rietveld 408576698