public void Awake() { foreach (Key k in UTEnum.GetEnumAsArray <Key>()) { _map[k.ToString()] = k; } }
public void GetEnumAsArray() { // Act TestEnum[] testArray = UTEnum.GetEnumAsArray <TestEnum>(); // Assert TestEnum[] answer = new TestEnum[] { TestEnum.TEST1, TestEnum.TEST3, TestEnum.TEST2 }; for (int i = 0; i < testArray.Length; i++) { Assert.That(testArray[i] == answer[i]); } }
public void Works() { // Arrange Interpolation interp = new Interpolation(1, 2, 2, EEasingFunction.Linear); // Act float t0 = interp.Interpolate(0); float t1 = interp.Interpolate(1); float t2 = interp.Interpolate(2); bool failed = false; foreach (EEasingFunction funcName in UTEnum.GetEnumAsArray <EEasingFunction>()) { DEasingFunction func = funcName.Function(); float zero = func(0); float one = func(1); if (zero != 0 || one != 1) { failed = true; break; } if (funcName.ToString().StartsWith("InOut")) { float point5 = func(0.5f); if (point5 != 0.5f) { failed = true; break; } } } // Assert Assert.That(t0 == 1); Assert.That(t1 == 1.5); Assert.That(t2 == 2); Assert.That(!failed); }
public void Works() { // Arrange EnumDicitonary <ETest, int> test = new EnumDicitonary <ETest, int>(1); // Act bool allInitalizedTo1 = true; foreach (ETest t in UTEnum.GetEnumAsArray <ETest>()) { if (test[t] != 1) { allInitalizedTo1 = false; } } test[ETest.BANANA] = 3; test[ETest.CHERRY] = 4; bool setsWorks = test[ETest.STRAWBERRY] == 1 && test[ETest.BANANA] == 3 && test[ETest.CHERRY] == 4; // Assert Assert.That(allInitalizedTo1 && setsWorks); }