public void TestBigIntAndByte() { var bytes = new byte[48]; var bigInt0 = new BigInteger("-123456"); BigIntConverter.BytesFromBigInt(bigInt0, bytes, 0, bytes.Length); var bigInt1 = BigIntConverter.BigIntFromBytes(bytes, 0, bytes.Length); Assert.AreEqual(bigInt0, bigInt1); }
public void TestTritsAndBigInt() { int[] inputTrits = new int[243]; for (int i = 0; i < inputTrits.Length; i++) { inputTrits[i] = Random.Next(3) - 1; } var bigInt = BigIntConverter.BigIntFromTrits(inputTrits, 0, inputTrits.Length); int[] outputTrits = new int[inputTrits.Length]; BigIntConverter.TritsFromBigInt(bigInt, outputTrits, 0, outputTrits.Length); for (int i = 0; i < inputTrits.Length; i++) { Assert.AreEqual(inputTrits[i], outputTrits[i]); } }