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

Unified Diff: tests/lib/typed_data/uint32x4_list_test.dart

Issue 51333005: Add Uint32x4List to typed_data (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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
« no previous file with comments | « sdk/lib/typed_data/typed_data.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/typed_data/uint32x4_list_test.dart
diff --git a/tests/lib/typed_data/float32x4_list_test.dart b/tests/lib/typed_data/uint32x4_list_test.dart
similarity index 59%
copy from tests/lib/typed_data/float32x4_list_test.dart
copy to tests/lib/typed_data/uint32x4_list_test.dart
index 8942186cf631d0b7ef72fb87f2a72a470efa369e..b9bae4e6eaddff7f0394aba4d6128ff04fd6f523 100644
--- a/tests/lib/typed_data/float32x4_list_test.dart
+++ b/tests/lib/typed_data/uint32x4_list_test.dart
@@ -4,29 +4,29 @@
// VMOptions=--deoptimization_counter_threshold=1000 --optimization-counter-threshold=10
// Library tag to be able to run in html test framework.
-library float32x4_list_test;
+library uint32x4_list_test;
import 'package:expect/expect.dart';
import 'dart:typed_data';
testLoadStore(array) {
Expect.equals(8, array.length);
- Expect.isTrue(array is List<Float32x4>);
- array[0] = new Float32x4(1.0, 2.0, 3.0, 4.0);
- Expect.equals(1.0, array[0].x);
- Expect.equals(2.0, array[0].y);
- Expect.equals(3.0, array[0].z);
- Expect.equals(4.0, array[0].w);
+ Expect.isTrue(array is List<Uint32x4>);
+ array[0] = new Uint32x4(1, 2, 3, 4);
+ Expect.equals(1, array[0].x);
+ Expect.equals(2, array[0].y);
+ Expect.equals(3, array[0].z);
+ Expect.equals(4, array[0].w);
array[1] = array[0];
- array[0] = array[0].withX(9.0);
- Expect.equals(9.0, array[0].x);
- Expect.equals(2.0, array[0].y);
- Expect.equals(3.0, array[0].z);
- Expect.equals(4.0, array[0].w);
- Expect.equals(1.0, array[1].x);
- Expect.equals(2.0, array[1].y);
- Expect.equals(3.0, array[1].z);
- Expect.equals(4.0, array[1].w);
+ array[0] = array[0].withX(9);
+ Expect.equals(9, array[0].x);
+ Expect.equals(2, array[0].y);
+ Expect.equals(3, array[0].z);
+ Expect.equals(4, array[0].w);
+ Expect.equals(1, array[1].x);
+ Expect.equals(2, array[1].y);
+ Expect.equals(3, array[1].z);
+ Expect.equals(4, array[1].w);
}
testLoadStoreDeopt(array, index, value) {
@@ -38,8 +38,8 @@ testLoadStoreDeopt(array, index, value) {
}
testLoadStoreDeoptDriver() {
- Float32x4List list = new Float32x4List(4);
- Float32x4 value = new Float32x4(1.0, 2.0, 3.0, 4.0);
+ Uint32x4List list = new Uint32x4List(4);
+ Uint32x4 value = new Uint32x4(1, 2, 3, 4);
for (int i = 0; i < 20; i++) {
testLoadStoreDeopt(list, 0, value);
}
@@ -72,15 +72,15 @@ testLoadStoreDeoptDriver() {
testLoadStoreDeopt(list, 0, value);
}
try {
- // non-Float32x4 value.
+ // non-Uint32x4 value.
testLoadStoreDeopt(list, 0, 4.toDouble());
} catch (_) {}
for (int i = 0; i < 20; i++) {
testLoadStoreDeopt(list, 0, value);
}
try {
- // non-Float32x4List list.
- testLoadStoreDeopt([new Float32x4(2.0, 3.0, 4.0, 5.0)], 0, value);
+ // non-Uint32x4List list.
+ testLoadStoreDeopt([new Uint32x4(2, 3, 4, 5)], 0, value);
} catch (_) {}
for (int i = 0; i < 20; i++) {
testLoadStoreDeopt(list, 0, value);
@@ -88,40 +88,40 @@ testLoadStoreDeoptDriver() {
}
testListZero() {
- Float32x4List list = new Float32x4List(1);
- Expect.equals(0.0, list[0].x);
- Expect.equals(0.0, list[0].y);
- Expect.equals(0.0, list[0].z);
- Expect.equals(0.0, list[0].w);
+ Uint32x4List list = new Uint32x4List(1);
+ Expect.equals(0, list[0].x);
+ Expect.equals(0, list[0].y);
+ Expect.equals(0, list[0].z);
+ Expect.equals(0, list[0].w);
}
testView(array) {
Expect.equals(8, array.length);
- Expect.isTrue(array is List<Float32x4>);
- Expect.equals(0.0, array[0].x);
- Expect.equals(1.0, array[0].y);
- Expect.equals(2.0, array[0].z);
- Expect.equals(3.0, array[0].w);
- Expect.equals(4.0, array[1].x);
- Expect.equals(5.0, array[1].y);
- Expect.equals(6.0, array[1].z);
- Expect.equals(7.0, array[1].w);
+ Expect.isTrue(array is List<Uint32x4>);
+ Expect.equals(0, array[0].x);
+ Expect.equals(1, array[0].y);
+ Expect.equals(2, array[0].z);
+ Expect.equals(3, array[0].w);
+ Expect.equals(4, array[1].x);
+ Expect.equals(5, array[1].y);
+ Expect.equals(6, array[1].z);
+ Expect.equals(7, array[1].w);
}
testSublist(array) {
Expect.equals(8, array.length);
- Expect.isTrue(array is Float32x4List);
+ Expect.isTrue(array is Uint32x4List);
var a = array.sublist(0, 1);
Expect.equals(1, a.length);
- Expect.equals(0.0, a[0].x);
- Expect.equals(1.0, a[0].y);
- Expect.equals(2.0, a[0].z);
- Expect.equals(3.0, a[0].w);
+ Expect.equals(0, a[0].x);
+ Expect.equals(1, a[0].y);
+ Expect.equals(2, a[0].z);
+ Expect.equals(3, a[0].w);
a = array.sublist(1, 2);
- Expect.equals(4.0, a[0].x);
- Expect.equals(5.0, a[0].y);
- Expect.equals(6.0, a[0].z);
- Expect.equals(7.0, a[0].w);
+ Expect.equals(4, a[0].x);
+ Expect.equals(5, a[0].y);
+ Expect.equals(6, a[0].z);
+ Expect.equals(7, a[0].w);
a = array.sublist(0);
Expect.equals(a.length, array.length);
for (int i = 0; i < array.length; i++) {
@@ -135,16 +135,16 @@ testSublist(array) {
main() {
var list;
- list = new Float32x4List(8);
+ list = new Uint32x4List(8);
for (int i = 0; i < 20; i++) {
testLoadStore(list);
}
- Float32List floatList = new Float32List(32);
- for (int i = 0; i < floatList.length; i++) {
- floatList[i] = i.toDouble();
+ Uint32List uint32List = new Uint32List(32);
+ for (int i = 0; i < uint32List.length; i++) {
+ uint32List[i] = i;
}
- list = new Float32x4List.view(floatList.buffer);
+ list = new Uint32x4List.view(uint32List.buffer);
for (int i = 0; i < 20; i++) {
testView(list);
}
« no previous file with comments | « sdk/lib/typed_data/typed_data.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698