<ExcludeList Include="$(XunitTestBinBase)\JIT\Directed\lifetime\lifetime2.cmd" >
<Issue>1037</Issue>
</ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\BugWithAVX.cmd" >
+ <Issue>1441</Issue>
+ </ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\CtorFromArray.cmd" >
+ <Issue>1441</Issue>
+ </ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\Haar-likeFeaturesGeneric.cmd" >
+ <Issue>1441</Issue>
+ </ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\CreateGeneric.cmd" >
+ <Issue>1441</Issue>
+ </ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\BitwiseOperations.cmd" >
+ <Issue>1441</Issue>
+ </ExcludeList>
</ItemGroup>
</Project>
{
class Program
{
+ const float EPS = Single.Epsilon * 5;
-
+ static short[] GenerateArray(int size, short value)
+ {
+ short[] arr = new short[size];
+ for (int i = 0; i < size; ++i)
+ {
+ arr[i] = value;
+ }
+ return arr;
+ }
static int Main(string[] args)
{
- short[] arr = new short[] {-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5};
+ short[] arr = GenerateArray(60, 5);
var a = new System.Numerics.Vector<short>(arr);
a = System.Numerics.Vector.Abs(a);
if (a[0] != 5)
{
return 0;
}
-
return 100;
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
-
- static int Main(string[] args)
- {
- var a = new System.Numerics.Vector<short>(-5);
- a = System.Numerics.Vector.Abs(a);
- if (a[0] != 5)
- {
- return 0;
- }
- var b = System.Numerics.Vector<int>.One;
- b = System.Numerics.Vector.Abs(b);
- if (b[3] != 1)
- {
- return 0;
- }
- var c = new System.Numerics.Vector<long>(-11);
- c = System.Numerics.Vector.Abs(c);
- if (c[1] != 11)
- {
- return 0;
- }
-
- var d = new System.Numerics.Vector<double>(-100.0);
- d = System.Numerics.Vector.Abs(d);
- if (d[0] != 100)
- {
- return 0;
- }
- var e = new System.Numerics.Vector<float>(-22);
- e = System.Numerics.Vector.Abs(e);
- if (e[3] != 22)
- {
- return 0;
- }
- var f = new System.Numerics.Vector<ushort>(21);
- f = System.Numerics.Vector.Abs(f);
- if (f[7] != 21)
- {
- return 0;
- }
- var g = new System.Numerics.Vector<ulong>(21);
- g = System.Numerics.Vector.Abs(g);
- if (g[1] != 21)
- {
- return 0;
- }
-
- return 100;
- }
- }
-}
{
class Program
{
-
-
-
static int Main(string[] args)
{
- Point a = new Point(1, 2, 3, 4);
- Point b = new Point(2, 2, 1, 1);
- float c = 33;
- Point d = (b + a) * c;
- Point q = d + a;
- Point s = Point.SquareRoot(q);
+ Point a = new Point(11, 13, 8, 4);
+ Point b = new Point(11, 13, 2, 1);
+ Point d = a * b;
+ Point s = Point.SquareRoot(d);
s *= -1;
s = Point.Abs(s);
- return (int)(s).X * 10;
+ if ((int)(s.X) == 11 && (int)(s.Y) == 13 && (int)(s.Z) == 4 && (int)(s.W) == 2)
+ {
+ return 100;
+ }
+ return 0;
}
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
-
- static int Main(string[] args)
- {
- Point a = new Point(3, 60);
- Point b = new Point(10, 40);
- return (int)(a + b).Y;
- }
- }
-}
{
class Program
{
+ const float EPS = Single.Epsilon * 5;
+
+ static bool CheckEQ(float a, float b)
+ {
+ return Math.Abs(a - b) < 5 * EPS;
+ }
+
+ static bool CheckNEQ(float a, float b)
+ {
+ return !CheckEQ(a, b);
+ }
static int Adds()
{
a += b;
a += b;
a += b;
- if (a.X != 10 || a.Y != 20)
+ if (CheckNEQ(a.X, 10) || CheckNEQ(a.Y, 20))
{
return 0;
}
return 100;
-
}
-
static int Main(string[] args)
{
-
-
Point a = new Point(0, 0), b = new Point(1, 0);
Point c = a + b;
Point d = c - b;
Point e = d - a;
- if (e.X != 0 || e.Y != 0)
+ if (CheckNEQ(e.X, 0) || CheckNEQ(e.Y, 0))
{
return 0;
}
-
e += e;
- if (e.X != 0 || e.Y != 0)
+ if (CheckNEQ(e.X, 0) || CheckNEQ(e.Y, 0))
{
return 0;
}
-
a += new Point(5, 2);
e += a + b;
- if (e.X != 6 || e.Y != 2)
+ if (CheckNEQ(e.X, 6) || CheckNEQ(e.Y, 2))
{
return 0;
}
e *= 10;
- if (e.X != 60 || e.Y != 20)
+ if (CheckNEQ(e.X, 60) || CheckNEQ(e.Y, 20))
{
return 0;
}
- // Debug.Assert(e.X == 0 && e.Y == 0);
if (Adds() != 100)
{
return 0;
{
class Program
{
-
static float NextFloat(Random random)
{
double mantissa = (random.NextDouble() * 2.0) - 1.0;
return (float)(mantissa * exponent);
}
-
static int TestDouble()
{
- // care with NAN, it is very ofter situation.
Random random = new Random(11);
double[] arr1 = new double[] { NextFloat(random), NextFloat(random), NextFloat(random), NextFloat(random) };
double[] arr2 = new double[] { NextFloat(random), NextFloat(random), NextFloat(random), NextFloat(random) };
}
r = f | s;
d = BitConverter.Int64BitsToDouble(r);
- if (orR[i] != d)
+ if (orR[i] != d && d == d)
{
return 0;
}
return (byte)random.Next(0, 255);
}
+ static byte[] GenerateByteArray(int size, Random random)
+ {
+ byte[] arr = new byte[size];
+ for (int i = 0; i < size; ++i)
+ {
+ arr[i] = NextByte(random);
+ }
+ return arr;
+ }
+
static int TestBool()
{
Random random = new Random(13);
- byte[] arr1 = new byte[] { NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random) };
- byte[] arr2 = new byte[] { NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random) };
+ byte[] arr1 = GenerateByteArray(64, random);
+ byte[] arr2 = GenerateByteArray(64, random);
var a = new System.Numerics.Vector<byte>(arr1);
var b = new System.Numerics.Vector<byte>(arr2);
return 0;
}
d = a[i] | b[i];
- if (orR[i] != d && d == d)
+ if (orR[i] != d)
{
return 0;
}
{
class Program
{
-
-
-
static int Main(string[] args)
{
- var a = new System.Numerics.Vector<int>(1);
- object b = a;
- if (b is System.Numerics.Vector<int>)
{
- var c = (System.Numerics.Vector<int>)b;
- if (a != c)
+ var a = new System.Numerics.Vector<int>(1);
+ object b = a;
+ if (b is System.Numerics.Vector<int>)
+ {
+ var c = (System.Numerics.Vector<int>)b;
+ if (a != c)
+ {
+ return 0;
+ }
+ }
+ else
{
return 0;
}
}
- else
{
- return 0;
+ var a = new System.Numerics.Vector4(1);
+ object b = a;
+ if (b is System.Numerics.Vector4)
+ {
+ var c = (System.Numerics.Vector4)b;
+ if (a != c)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
}
-
-
return 100;
}
}
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
+
+using System.Numerics;
namespace VectorMathTests
{
class Program
{
-
-
-
static int Main(string[] args)
{
-
-
+ int Count = System.Numerics.Vector<int>.Count;
return 100;
}
}
+// Test generates Points, builds ConvexHull and then find the biggest Circle inside it.
+
using System;
using System.Collections.Generic;
using System.Linq;
{
const float EPS = 1E-9F;
const int steps = 100;
- const float INF = 1000000;
- //public struct Point
- //{
- // public double X, Y;
- // public static Point operator -(Point a, Point b)
- // {
- // Point r;
- // r.X = a.X - b.X;
- // r.Y = a.Y - b.Y;
- // return r;
- // }
-
-
-
- //}
+ const float INF = Single.PositiveInfinity;
public static float vectMul(Point a, Point b)
{
a = b;
b = c;
}
-
+
+
+ // Calc the radius of a circle, with a center in (x, y), the is bounded with Lines.
static public float radius(float x, float y, List<Line> l)
{
-
-
int n = (int)l.Count;
float res = INF;
for (int i = 0; i < n; ++i)
return res;
}
+ // Find y and calc the radius of a circle, with a center in (x), tha is bounded with Lines.
static public float y_radius(float x, List<Point> a, List<Line> l, out float yOut)
{
-
-
int n = (int)a.Count;
float ly = INF, ry = -INF;
for (int i = 0; i < n; ++i)
swap(ref x1, ref x2);
swap(ref y1, ref y2);
}
-
if (x1 <= x + EPS && x - EPS <= x2)
{
float y = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
return radius(x, ly, l);
}
-
-
-
static public Boolean Check(List<Point> points)
{
float zn = vectMul((points[2] - points[0]), (points[1] - points[0]));
for (int i = 2; i < points.Count; ++i)
{
float z = vectMul((points[i] - points[i - 2]), (points[i - 1] - points[i - 2]));
-
if (z * zn < 0)
{
return true;
}
- static public Boolean Solve(List<Point> points, out Point O, out float r)
+ static public Boolean FindCircle(List<Point> points, out Point O, out float r)
{
O.X = 0;
O.Y = 0;
r = 0;
-
if (points.Count < 3)
return false;
points.Add(points[0]);
else
rx = x2;
}
-
float y;
float ans = y_radius(lx, points, l, out y);
O.X = lx;
O.Y = y;
r = ans;
-
return true;
}
double mantissa = (random.NextDouble() * 2.0) - 1.0;
double exponent = Math.Pow(2.0, random.Next(-32, 32));
return (float)(mantissa * exponent);
- }
+ }
static int Main(string[] args)
{
convex_hull(points);
Point O;
float r;
- Solve(points, out O, out r);
+ FindCircle(points, out O, out r);
-
- if (r >= 999999.9 - 1 && r <= 999999.9 + 1)
+ float expRes = 7.565624E7F;
+ if (Math.Abs(r - expRes) > EPS)
return 100;
return 0;
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
-
- static int Main(string[] args)
- {
- Point a = new Point(100, 100);
-
- return (int)a.X;
- }
- }
-}
{
class Program
{
-
-
-
+ const float EPS = Single.Epsilon * 5;
+
static int Main(string[] args)
{
-
- var a = new System.Numerics.Vector<float>(1);
+ var a = new System.Numerics.Vector<short>(51);
+ for (int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
+ {
+ if (a[i] != 51)
+ {
+ return 0;
+ }
+ }
+ var b = System.Numerics.Vector<int>.One;
+ for (int i = 0; i < System.Numerics.Vector<int>.Count; ++i)
+ {
+ if (b[i] != 1)
+ {
+ return 0;
+ }
+ }
+ var c = System.Numerics.Vector<short>.One;
+ for (int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
+ {
+ if (c[i] != 1)
+ {
+ return 0;
+ }
+ }
+ var d = new System.Numerics.Vector<double>(100.0);
+ for (int i = 0; i < System.Numerics.Vector<double>.Count; ++i)
+ {
+ if (Math.Abs(d[i] - 100.0) > EPS)
+ {
+ return 0;
+ }
+ }
+
+ var e = new System.Numerics.Vector<float>(100);
+ for (int i = 0; i < System.Numerics.Vector<float>.Count; ++i)
+ {
+ if (Math.Abs(e[i] - 100.0) > EPS)
+ {
+ return 0;
+ }
+ }
+ var f = c * 49;
+ var g = f + a;
- return 100;
-
+ if (g[0] == 100)
+ {
+ return 100;
+ }
+ return 0;
}
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
-
- static int Main(string[] args)
- {
- var a = new System.Numerics.Vector<short>(51);
- for(int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
- {
- if (a[i] != 51)
- {
- return 0;
- }
- }
- var b = System.Numerics.Vector<int>.One;
- for(int i = 0; i < System.Numerics.Vector<int>.Count; ++i)
- {
- if (b[i] != 1)
- {
- return 0;
- }
- }
- var c = System.Numerics.Vector<short>.One;
- for(int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
- {
- if (c[i] != 1)
- {
- return 0;
- }
- }
- var d = new System.Numerics.Vector<double>(100.0);
- for(int i = 0; i < System.Numerics.Vector<double>.Count; ++i)
- {
- if (d[i] != 100.0)
- {
- return 0;
- }
- }
-
- var e = new System.Numerics.Vector<float>(100);
- for(int i = 0; i < System.Numerics.Vector<float>.Count; ++i)
- {
- if (e[i] != 100.0)
- {
- return 0;
- }
- }
- var f = c * 49;
- var g = f + a;
-
- short[] array1 = new short[] { 1, 3, 5, 7, 9, 2, 1, 1, 1,5,4,3,1,2,3,5,6,7,1,1,1,1 };
- var w = new System.Numerics.Vector<short>(array1);
- return g[0];
- //return (int)c[1] + (int)b[3] - 100 + a[2] - 2 * d[1];
-
- }
- }
-}
{
class Program
{
- static int test(int[] arr)
+ static int[] GenerateArray(int size, int value)
{
- int a = arr[0];
- return a;
+ int[] arr = new int[size];
+ for (int i = 0; i < size; ++i)
+ {
+ arr[i] = value;
+ }
+ return arr;
}
static int Main(string[] args)
{
- int[] arr = new int[] {1,2,3,4,5,6,7,8};
- Point p = new Point(arr, 0);
+ int v = 2;
+ int[] arr = GenerateArray(20, v);
+ Point p = new Point(arr);
for (int i = 0; i < Point.Count; ++i)
{
- if (p[i] != arr[i])
+ if (p[i] != v)
{
return 0;
}
}
return 100;
-
-
-
}
}
}
namespace VectorMathTests
{
class Program
- {
+ {
+ const float EPS = Single.Epsilon * 5;
+
+ static bool CheckEQ(float a, float b)
+ {
+ return Math.Abs(a - b) < EPS;
+ }
+
+ static bool CheckNEQ(float a, float b)
+ {
+ return !CheckEQ(a, b);
+ }
static int Vector2Ctors()
{
Vector2 a = new Vector2(45, 12);
- if (a.X != 45 || a.Y != 12)
+ if (CheckNEQ(a.X, 45) || CheckNEQ(a.Y, 12))
return 0;
a.X = 100;
Vector2 b = new Vector2(65);
- if (b.X != 65 || b.Y != 65)
+ if (CheckNEQ(b.X, 65) || CheckNEQ(b.Y, 65))
return 0;
return 100;
-
}
static int Vector3Ctors()
{
Vector3 a = new Vector3(0, 1, 2);
- if (a.X != 0 || a.Y != 1 || a.Z != 2)
+ if (CheckNEQ(a.X, 0) || CheckNEQ(a.Y, 1) || CheckNEQ(a.Z, 2))
return 0;
Vector3 b = new Vector3(2);
- if (b.X != 2 || b.Y != 2 || b.Z != 2)
+ if (CheckNEQ(b.X, 2) || CheckNEQ(b.Y, 2) || CheckNEQ(b.Z, 2))
return 0;
Vector2 q = new Vector2(10, 1);
Vector3 c = new Vector3(q, 5);
- if (c.X != q.X || c.Y != q.Y || c.Z != 5)
+ if (CheckNEQ(c.X, q.X) || CheckNEQ(c.Y, q.Y) || CheckNEQ(c.Z, 5))
return 0;
return 100;
-
}
static int Vector4Ctors()
{
Vector4 a = new Vector4(0, 1, 2, 3);
- if (a.X != 0 || a.Y != 1 || a.Z != 2 || a.W != 3)
+ if (CheckNEQ(a.X, 0) || CheckNEQ(a.Y, 1) || CheckNEQ(a.Z, 2) || CheckNEQ(a.W, 3))
return 0;
Vector4 b = new Vector4(2);
- if (b.X != 2 || b.Y != 2 || b.Z != 2 || b.W != 2)
+ if (CheckNEQ(b.X, 2) || CheckNEQ(b.Y, 2) || CheckNEQ(b.Z, 2) || CheckNEQ(b.W, 2))
return 0;
Vector2 q = new Vector2(10, 1);
Vector4 c = new Vector4(q, 10, -1);
- if (c.X != q.X || c.Y != q.Y || c.Z != 10 || c.W != -1)
+ if (CheckNEQ(c.X, q.X) || CheckNEQ(c.Y, q.Y) || CheckNEQ(c.Z, 10) || CheckNEQ(c.W, -1))
return 0;
Vector3 w = new Vector3(5);
Vector4 d = new Vector4(w, 2);
- if (d.X != w.X || d.Y != w.Y || d.Z != w.Z || d.W != 2)
+ if (CheckNEQ(d.X, w.X) || CheckNEQ(d.Y, w.Y) || CheckNEQ(d.Z, w.Z) || CheckNEQ(d.W, 2))
return 0;
return 100;
}
-
static int Main(string[] args)
{
if (Vector2Ctors() != 100 || Vector3Ctors() != 100 || Vector4Ctors() != 100)
{
class Program
{
-
-
-
static int Main(string[] args)
{
{
{
class Program
{
-
static Point a;
-
static int Main(string[] args)
{
Point p = new Point(1, 2, 3, 4);
{
class Program
{
-
+ const float EPS = Single.Epsilon * 5;
+
static float NextFloat(Random random)
{
double mantissa = (random.NextDouble() * 2.0) - 1.0;
static double[] VectorFilter(double[] color, double[] mask)
{
int count = Point.Count;
-
int N = color.Length;
double[] res = new double[N];
for (int i = 0; i < N; i += count)
static double[] VectorAndFilter(double[] color, double[] mask)
{
int count = Point.Count;
-
int N = color.Length;
double[] res = new double[N];
for (int i = 0; i < N; i += count)
res[i + j] = r[j];
}
}
-
return res;
}
static double[] SimpleFilter(double[] color, double[] mask)
- {
+ {
int N = color.Length;
double[] res = new double[N];
for (int i = 0; i < N; i += 1)
else
{
res[i] = 1;
- }
+ }
}
return res;
}
double[] res = new double[N];
for (int i = 0; i < N; ++i)
{
-
+
if (mask[i] == 0)
{
res[i] = 0;
int N = a.Length;
for (int i = 0; i < N; ++i)
{
- if (a[i] != b[i])
+ if (Math.Abs(a[i] - b[i]) > EPS)
{
return false;
}
}
return true;
}
-
+
static int Main(string[] args)
{
Random random = new Random(13);
double[] res = VectorFilter(color, mask);
double[] check = SimpleFilter(color, mask);
double[] andRes = VectorAndFilter(color, andMask);
-
+
if (checkEQ(res, check) == false)
{
return 0;
{
return 0;
}
-
-
return 100;
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector<int>;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
- static int Main(string[] args)
- {
- int[] arr = new int[] {1,1,1,1,1,1,1,1,1,1,1,1};
- Point p = new Point(arr);
-
-
- return 100;
- }
- }
-}
{
class Program
{
-
static float Do(Point p)
{
return p.X;
public Point p;
}
-
static int Main(string[] args)
{
Point p = new Point(1, 2, 3, 4);
C c = new C();
s.p.X = 1;
c.p.Y = 2;
- if (Do(s.p) != 1)
+ if (((int)Do(s.p) != 1))
+ {
+ return 0;
+ }
+ if (((int)c.p.X) != 0 || ((int)c.p.Y) != 2)
{
return 0;
}
- if (c.p.X != 0 || c.p.Y != 2)
+ Point[] fixedArr = new Point[5];
+ Point fixedPoint = new Point(1);
+ fixedArr[0] = fixedPoint;
+ if (fixedArr[0].X != 1)
+ {
+ return 0;
+ }
+
+ List<Point> points = new List<Point>();
+ points.Add(fixedPoint);
+ if (((int)points[0].X) != 1 && ((int)points[0].Y) != 2)
{
return 0;
}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Point = System.Numerics.Vector<int>;
+
+namespace VectorMathTests
+{
+ class Program
+ {
+ static float Do(Point p)
+ {
+ return p[0];
+ }
+
+ struct S
+ {
+ public Point p;
+ }
+
+ class C
+ {
+ public Point p;
+ }
+
+ static int Main(string[] args)
+ {
+ Point p = new Point(1);
+
+ S s = new S();
+ C c = new C();
+ s.p = new Point(1);
+ c.p = new Point(2);
+ if (((int)Do(s.p) != 1))
+ {
+ return 0;
+ }
+ if (((int)c.p[1]) != 2 || ((int)c.p[1]) != 2)
+ {
+ return 0;
+ }
+ Point[] fixedArr = new Point[5];
+ Point fixedPoint = new Point(1);
+ fixedArr[0] = fixedPoint;
+ if (fixedArr[0][0] != 1)
+ {
+ return 0;
+ }
+
+ List<Point> points = new List<Point>();
+ points.Add(fixedPoint);
+ if (points[0][1] != 1)
+ {
+ return 0;
+ }
+
+ return 100;
+ }
+ }
+}
using System.Runtime.InteropServices;
using Point = System.Numerics.Vector4;
-
namespace Test
-{
- [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 8)]
-
+{
static class Program
{
static int Main()
Do1(&x, &y);
Do2(&y, &z);
}
- if (y.X != 1)
+ if (((int)y.X) != 1)
{
return 0;
}
- if (z.X != 1)
+ if (((int)z.X) != 1)
{
return 0;
}
using System;
using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
+using Point = System.Numerics.Vector4;
namespace VectorMathTests
{
class Program
{
-
-
-
static int Main(string[] args)
{
- Point a = new Point(10, 50);
- Point b = new Point(10, 10);
+ Point a = new Point(10, 50,0,-100);
+ Point b = new Point(10);
Point c = Point.Max(a, b);
- if (c.Y != 50)
+ if (((int)c.Y) != 50 || ((int)c.W) != 10)
+ {
+ return 0;
+ }
+ Point d = Point.Min(a, b);
+ Point q = Point.Min(d, d);
+ if (q != d)
+ {
+ return 0;
+ }
+ if (((int)d.W) != -100)
{
return 0;
- }
+ }
return 100;
}
}
{
class Program
{
-
-
-
static int Main(string[] args)
{
Point a = new Point(10, 50);
Point b = new Point(10, 10);
Point c = a * b;
- return (int)c.X;
+ if (((int)c.X) == 100)
+ {
+ return 100;
+ }
+ return 0;
}
}
}
{
class Program
{
-
-
-
static int Main(string[] args)
{
+ Random random = new Random(13);
var a = new System.Numerics.Vector<short>(25);
a = System.Numerics.Vector.SquareRoot(a);
if (a[0] != 5)
{
return 0;
}
-
var d = new System.Numerics.Vector<double>(100.0);
d = System.Numerics.Vector.SquareRoot(d);
- if (d[0] != 10)
+ if (((int)d[0]) != 10)
{
return 0;
}
var e = new System.Numerics.Vector<float>(64);
e = System.Numerics.Vector.SquareRoot(e);
- if (e[3] != 8)
+ if (((int)e[3]) != 8)
{
return 0;
}
{
return 0;
}
-
return 100;
}
}
using System.Collections.Generic;
using Point = System.Numerics.Vector<int>;
-namespace VectorMathTests
+namespace VectorTests
{
class Program
{
-
-
-
static int Main(string[] args)
{
Point p = new Point(1);
Point[] arr = new Point[10];
- arr[0] = p; //loadelem
+ arr[0] = p; // Loadelem bytecode.
arr[2] = p;
if (arr[0] == arr[1] || arr[2] != p)
{
return 0;
}
-
return 100;
}
}
{
class Program
{
-
static float NextFloat(Random random)
{
double mantissa = (random.NextDouble() * 2.0) - 1.0;
return (float)(mantissa * exponent);
}
-
static float sum(Point[] arr)
{
int n = arr.Length;
return s.X;
}
-
static int Main(string[] args)
{
System.Diagnostics.Stopwatch clock = new System.Diagnostics.Stopwatch();
using System.Collections.Generic;
using Point = System.Numerics.Vector3;
-namespace VectorMathTests
+namespace VectorTests
{
class Program
{
-
-
+ const float EPS = Single.Epsilon * 5;
+
+ static bool CheckEQ(float a, float b)
+ {
+ return Math.Abs(a - b) < EPS;
+ }
static int Main(string[] args)
{
- Point a = new Point(1,2,3);
- Point b = new Point(2,2, 5);
- float c = 33;
- Point d = (b + a)*c;
- Point q = d + a;
- return (int)(q).X;
+ Point a = new Point(1, 2, 3);
+ Point b = new Point(2, 2, 5);
+ float c = 33;
+ Point d = (b + a) * c;
+ Point q = d + a;
+ if (CheckEQ(q.X, 100))
+ {
+ return 100;
+ }
+ return 0;
}
}
}
using System.Collections.Generic;
using Point = System.Numerics.Vector4;
-namespace VectorMathTests
+namespace VectorTests
{
class Program
{
+ const float EPS = Single.Epsilon * 5;
-
+ static bool CheckEQ(float a, float b)
+ {
+ return Math.Abs(a - b) < EPS;
+ }
static int Main(string[] args)
{
- Point a = new Point(1,2,3,4);
- Point b = new Point(2,2,1,1);
- float c = 33;
- Point d = (b + a)*c;
- Point q = d + a;
- return (int)(q).X;
+ Point a = new Point(1, 2, 3, 4);
+ Point b = new Point(2, 2, 1, 1);
+ float c = 33;
+ Point d = (b + a) * c;
+ Point q = d + a;
+ if (CheckEQ(q.X, 100))
+ {
+ return 100;
+ }
+ return 0;
}
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector<int>;
-
-namespace VectorMathTests
-{
- class Program
- {
-
-
-
- static int Main(string[] args)
- {
- Point p = new Point(1);
- Point[] arr = new Point[10];
- arr[0] = p; //loadelem
- arr[2] = p;
- if (arr[0] == arr[1] || arr[2] != p)
- {
- return 0;
- }
-
- return 100;
- }
- }
-}