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

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

Issue 278593003: Don't use a float32list as storage for simd. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file. Created 6 years, 5 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 | « tests/lib/lib.status ('k') | tests/lib/typed_data/float32x4_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/typed_data/float32x4_list_test.dart
diff --git a/tests/lib/typed_data/float32x4_list_test.dart b/tests/lib/typed_data/float32x4_list_test.dart
index 8942186cf631d0b7ef72fb87f2a72a470efa369e..d0207098c9c81de47dca32237d8e3cb139614e85 100644
--- a/tests/lib/typed_data/float32x4_list_test.dart
+++ b/tests/lib/typed_data/float32x4_list_test.dart
@@ -132,6 +132,98 @@ testSublist(array) {
}
}
+void testSpecialValues(array) {
+
+ /// Same as Expect.identical, but also works with NaNs and -0.0 for dart2js.
+ void checkEquals(expected, actual) {
+ if (expected.isNaN) {
+ Expect.isTrue(actual.isNaN);
+ } else if (expected == 0.0 && expected.isNegative) {
+ Expect.isTrue(actual == 0.0 && actual.isNegative);
+ } else {
+ Expect.equals(expected, actual);
+ }
+ }
+
+ var pairs = [
+ [0.0, 0.0],
+ [5e-324, 0.0],
+ [2.225073858507201e-308, 0.0],
+ [2.2250738585072014e-308, 0.0],
+ [0.9999999999999999, 1.0],
+ [1.0, 1.0],
+ [1.0000000000000002, 1.0],
+ [4294967295.0, 4294967296.0],
+ [4294967296.0, 4294967296.0],
+ [4503599627370495.5, 4503599627370496.0],
+ [9007199254740992.0, 9007199254740992.0],
+ [1.7976931348623157e+308, double.INFINITY],
+ [0.49999999999999994, 0.5],
+ [4503599627370497.0, 4503599627370496.0],
+ [9007199254740991.0, 9007199254740992.0],
+ [double.INFINITY, double.INFINITY],
+ [double.NAN, double.NAN],
+ ];
+
+ var conserved = [
+ 1.401298464324817e-45,
+ 1.1754942106924411e-38,
+ 1.1754943508222875e-38,
+ 0.9999999403953552,
+ 1.0000001192092896,
+ 8388607.5,
+ 8388608.0,
+ 3.4028234663852886e+38,
+ 8388609.0,
+ 16777215.0,
+ ];
+
+ var minusPairs = pairs.map((pair) {
+ return [-pair[0], -pair[1]];
+ });
+ var conservedPairs = conserved.map((value) => [value, value]);
+
+ var allTests = [pairs, minusPairs, conservedPairs].expand((x) => x);
+
+ for (var pair in allTests) {
+ var input = pair[0];
+ var expected = pair[1];
+ var f;
+ f = new Float32x4(input, 2.0, 3.0, 4.0);
+ array[0] = f;
+ f = array[0];
+ checkEquals(expected, f.x);
+ Expect.equals(2.0, f.y);
+ Expect.equals(3.0, f.z);
+ Expect.equals(4.0, f.w);
+
+ f = new Float32x4(1.0, input, 3.0, 4.0);
+ array[1] = f;
+ f = array[1];
+ Expect.equals(1.0, f.x);
+ checkEquals(expected, f.y);
+ Expect.equals(3.0, f.z);
+ Expect.equals(4.0, f.w);
+
+ f = new Float32x4(1.0, 2.0, input, 4.0);
+ array[2] = f;
+ f = array[2];
+ Expect.equals(1.0, f.x);
+ Expect.equals(2.0, f.y);
+ checkEquals(expected, f.z);
+ Expect.equals(4.0, f.w);
+
+ f = new Float32x4(1.0, 2.0, 3.0, input);
+ array[3] = f;
+ f = array[3];
+ Expect.equals(1.0, f.x);
+ Expect.equals(2.0, f.y);
+ Expect.equals(3.0, f.z);
+ checkEquals(expected, f.w);
+ }
+}
+
+
main() {
var list;
@@ -157,5 +249,8 @@ main() {
for (int i = 0; i < 20; i++) {
testListZero();
}
+ for (int i = 0; i < 20; i++) {
+ testSpecialValues(list);
+ }
testLoadStoreDeoptDriver();
}
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/typed_data/float32x4_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698