public void CheckCodeArray() { StackFrame defaultTestCaseFrame = GetFrame($"{DefaultModuleName}!TestArray"); VariableCollection locals = defaultTestCaseFrame.Locals; Variable testArrayVariable = locals["testArray"]; CodeArray <int> testArray = new CodeArray <int>(testArrayVariable); Assert.Equal(10000, testArray.Length); foreach (int value in testArray) { Assert.Equal(0x12121212, value); } Variable testStdArrayVariable = locals["testStdArray"]; std.array <int> testStdArray = new std.array <int>(testStdArrayVariable); Assert.Equal(10000, testStdArray.Count); foreach (int value in testStdArray) { Assert.Equal(0x12121212, value); } Assert.Equal(0x12121212, testStdArray[testStdArray.Count - 1]); int[] a = testStdArray.ToArray(); Assert.Equal(10000, a.Length); foreach (int value in a) { Assert.Equal(0x12121212, value); } }
public void BoolContainers() { StackFrame defaultTestCaseFrame = GetFrame($"{DefaultModuleName}!TestBoolContainers"); VariableCollection locals = defaultTestCaseFrame.Locals; bool[] expectedArray = new bool[100]; for (int i = 0, j = 1; i < expectedArray.Length; i += j, j++) { for (int k = 0; k < j && i < expectedArray.Length; k++, i++) { expectedArray[i] = true; } } // C style array CodeArray <bool> carray = new CodeArray <bool>(locals["carray"]); Assert.Equal(expectedArray, carray); // std::array std.array <bool> array = new std.array <bool>(locals["array"]); Assert.Equal(expectedArray, array); // std::vector std.vector <bool> vector = new std.vector <bool>(locals["vector"]); Assert.True(expectedArray.Length < vector.Reserved); Assert.Equal(expectedArray, vector); Assert.Equal(expectedArray, vector.ToArray()); }