[Fact] public void GreaterEqual() { Data_Generator dg = new Data_Generator(); Vector v1 = dg.newVector(); Vector v2 = dg.newVector(); (bool exp_x, bool exp_y, bool exp_z) = dg.newBoolTuple(); if (v1.x >= v2.x) { exp_x = true; } if (v1.y >= v2.y) { exp_y = true; } if (v1.z >= v2.z) { exp_z = true; } VectorHelper v = new VectorHelper(); (bool act_x, bool act_y, bool act_z) = v.greaterEqual(v1, v2); test.Equals(exp_x, act_x); test.Equals(exp_y, act_y); test.Equals(exp_z, act_z); }
[Fact] public void Add() { Data_Generator dg = new Data_Generator(); Vector v1 = dg.newVector(); Vector v2 = dg.newVector(); Vector exp = new Vector { x = v1.x + v2.x, y = v1.y + v2.y, z = v1.z + v2.z }; VectorHelper v = new VectorHelper(); Vector act = v.add(v1, v2); test.vectorEqual(exp, act); }
[Fact] public void Div() { Data_Generator dg = new Data_Generator(); Vector v1 = dg.newVector(); float v2 = dg.newFloat(100); Vector exp = new Vector { x = v1.x / v2, y = v1.y / v2, z = v1.z / v2 }; VectorHelper v = new VectorHelper(); Vector act = v.div(v1, v2); test.vectorEqual(exp, act); }
[Fact] public void Pow() { Data_Generator dg = new Data_Generator(); Vector v1 = dg.newVector(); float f = dg.newFloat(100); Vector exp = new Vector { x = (float)Math.Pow(v1.x, f), y = (float)Math.Pow(v1.y, f), z = (float)Math.Pow(v1.z, f) }; VectorHelper v = new VectorHelper(); Vector act = v.pow(v1, f); test.vectorEqual(act, exp); }
[Fact] public void MinMax() { Data_Generator dg = new Data_Generator(); (Vector min, Vector max, Vector v)dat; dat.v = dg.newVector(); dat.min = new Vector(float.MinValue, float.MinValue, float.MinValue); dat.max = dg.newZeroVector(); (Vector min, Vector max)exp; exp.min = dat.min; exp.max = dat.v; var v = new VectorHelper(); var act = v.minMax(dat.min, dat.max, dat.v); test.vectorEqual(exp.min, act.min); test.vectorEqual(exp.max, act.max); }
public Bone newBone(Vector joint1, Vector joint2) => new Bone { PrevJoint = joint1, NextJoint = joint2, Center = dg.newVector(), Direction = dg.newVector(), Length = dg.newFloat(100), Width = dg.newFloat(100), Type = new Bone.BoneType() };