/// <summary> /// Checks if the specified <see cref="MLMultiArray"/> has correct values at (<paramref name="i"/>, /// <paramref name="j"/>) of the chip. /// </summary> /// <param name="pixel">The specified 2D array of <see cref="SKColor"/>s.</param> /// <param name="result">The specified <see cref="MLMultiArray"/>.</param> /// <param name="i">The specified index i.</param> /// <param name="j">The specified index j.</param> private static void AssertMLMultiArrayEntry(SKColor pixel, MLMultiArray result, int i, int j) { var h = SharedConstants.DefaultChipHeight - j - 1; var w = SharedConstants.DefaultChipWidth - i - 1; Assert.AreEqual(ColorMapping[pixel.Red].DoubleValue, result[PreProcessingService.ComputeIndex(0, h, w)].DoubleValue, Tolerance); Assert.AreEqual(ColorMapping[pixel.Green].DoubleValue, result[PreProcessingService.ComputeIndex(1, h, w)].DoubleValue, Tolerance); Assert.AreEqual(ColorMapping[pixel.Blue].DoubleValue, result[PreProcessingService.ComputeIndex(2, h, w)].DoubleValue, Tolerance); }
public void TestComputeIndex(int i, int j, int k) { Assert.AreEqual( i * SharedConstants.DefaultChipHeight * SharedConstants.DefaultChipWidth + j * SharedConstants.DefaultChipWidth + k, PreProcessingService.ComputeIndex(i, j, k)); }