public void Test_reference_full_transposed_from_reference_full_transposed() { int errorCode = 0; // success? try { object[] data = new object[120]; for (int i = 120; i-- > 0; ) data[i] = (double)i; ILArray<object> B = new ILArray<object>(data, 5, 4, 3, 2, 1, 1); ILArray<object> C = B.S(1); ILArray<object> A = C.S(1); errorCode = 0; if (A.m_data != B.m_data) throw new Exception(); errorCode = 1; if (A.Dimensions.NumberOfDimensions != 4) throw new Exception(); errorCode = 2; if (A.Dimensions[0] != 3 | A.Dimensions[1] != 2 | A.Dimensions[2] != 5 | A.Dimensions[3] != 4) throw new Exception(); errorCode = 3; object[] mdata = (object[])A.m_data; if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 120) throw new Exception(); errorCode = 4; ILIterator<object> It = A.CreateIterator(ILIteratorPositions.ILStart, 0); int count = 0; do { if (It.Value != data[count]) throw new Exception(); It.Increment(); count += 20; if (count > 119) { count = (count % 119); } } while (!It.IsAtStart()); Success("Test_reference_full_transposed_from_reference_full_transposed successful."); } catch (Exception e) { Error("Test_reference_full_transposed_from_reference_full_transposed failed at step: " + errorCode + " Msg: " + e.Message); } }
public void Test_reference_ranged_transposed_from_reference_full() { int errorCode = 0; // success? try { object[] data = new object[120]; for (int i = 120; i-- > 0; ) data[i] = (double)i; ILArray<object> B = new ILArray<object>(data, 5, 4, 1, 3, 2, 1, 1); // simulate referencing by creating "full" range ILArray<object> C = B.S(0); ILArray<object> A = C[3,"0:2,4;1,3;0;2,1,0,1"]; errorCode = 0; if (Object.Equals(A,null)) throw new Exception(); errorCode++; if (A.Dimensions.NumberOfDimensions != 3) throw new Exception(); errorCode++; if (A.Dimensions[0] != 4 | A.Dimensions[1] != 4 | A.Dimensions[2] != 2) throw new Exception(); errorCode++; object[] mdata = (object[])A.m_data; if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 32) throw new Exception(); errorCode++; // soll werte: double[] results = new double[32]{45,25,5,25,46,26,6,26,47,27,7,27,49,29 ,9,29,55,35,15,35,56,36,16,36,57,37,17,37,59,39,19,39}; ILIterator<object> I = A.CreateIterator(ILIteratorPositions.ILStart, 0); int count = 0; do { if (((Double)I.Value).CompareTo(results[count++]) != 0) throw new Exception(); I.Increment(); } while (!I.IsAtStart()); Success("Test_reference_ranged_transposed_from_reference_full successful."); } catch (Exception e) { Error("Test_reference_ranged_transposed_from_reference_full failed at step: " + errorCode + " Msg: " + e.Message); } }
// reference creation: non transposing, full public void Test_reference_full() { int errorCode = 0; // success? try { object[] data = new object[120]; for (int i = 120; i-- > 0; ) data[i] = (double)i; ILArray<object> B = new ILArray<object>(data, 5, 4, 3, 2, 1, 1); ILArray<object> A = B.S(0); errorCode = 0; if (Object.Equals(A, null)) throw new Exception(); errorCode++; if (A.Dimensions.NumberOfDimensions != 4) throw new Exception(); errorCode++; if (A.Dimensions[0] != 5 | A.Dimensions[1] != 4 | A.Dimensions[2] != 3 | A.Dimensions[3] != 2) throw new Exception(); errorCode++; object[] mdata = (object[])A.m_data; if (mdata.Length != 120 || A.Dimensions.NumberOfElements != 120) throw new Exception(); errorCode++; ILIterator<object> It = A.CreateIterator(ILIteratorPositions.ILStart, 0); int count = 0; do { if (It.Value != data[count++]) throw new Exception(); It.Increment(); } while (!It.IsAtEnd()); Success("Test_reference_full successful."); } catch (Exception e) { Error("Test_reference_full failed at step: " + errorCode + " Msg: " + e.Message); } }