using System; using System.Collections.Generic; namespace AssetRipper.MeshSharp.Tests { public class VectorTestCaseFactory { private Random _random; public VectorTestCaseFactory() { _random = new Random(); } public VectorTestCaseFactory(int seed) { _random = new Random(seed); } public (T, T, T) CreateOperationCase(Func op) where T : IVector, new() { T v1 = new T(); T v2 = new T(); T result = new T(); int n = v1.GetComponents().Length; List components1 = new List(); List components2 = new List(); List components3 = new List(); for (int i = 0; i < n; i++) { var a = _random.Next(-100, 100); var b = _random.Next(-100, 100); components1.Add(a); components2.Add(b); components3.Add(op(a, b)); } v1 = v1.SetComponents(components1.ToArray()); v2 = v2.SetComponents(components2.ToArray()); result = result.SetComponents(components3.ToArray()); return (v1, v2, result); } } }