public void Test_EncodedUintVector_LowerBound() { for (int bytes_per_value = 8; bytes_per_value <= 8; ++bytes_per_value) { EncodedUintVectorTesting.TestLowerBound_64(bytes_per_value, 10); if (bytes_per_value <= 4) { EncodedUintVectorTesting.TestLowerBound_32(bytes_per_value, 500); if (bytes_per_value <= 2) { EncodedUintVectorTesting.TestLowerBound_16(bytes_per_value, 100); } } } }
private static void TestEncodedUintVector <T>(T[] expected, int expected_bytes) { switch (expected) { case ushort[] _ushort: EncodedUintVectorTesting.TestEncodedUintVector_16(_ushort, expected_bytes); break; case uint[] _uint: EncodedUintVectorTesting.TestEncodedUintVector_32(_uint, expected_bytes); break; case ulong[] _ulong: EncodedUintVectorTesting.TestEncodedUintVector_64(_ulong, expected_bytes); break; default: throw new NotSupportedException(typeof(T).FullName); } }
public void Test_EncodedUintVectorTest_RoundtripEncoding() { var values = new ulong[] { 10, 20, 30, 40 }; Encoder a_encoder = new(); var a = EncodedUintVectorTesting.MakeEncodedVector_64(values, a_encoder); Assert.Equal(a.Decode(), values); Encoder b_encoder = new(); a.Encode(b_encoder); var decoder = b_encoder.Decoder(); EncodedUintVector_UInt64 v2 = new(); Assert.True(v2.Init(decoder)); Assert.Equal(v2.Decode(), values); }