Beispiel #1
0
        private static void Evaluate(int input, int expected, int sourceBase, int targetBase)
        {
            var test = new NumberWithBase(input, sourceBase);

            test.ChangeBase(targetBase);
            Assert.AreEqual(expected, test.Value);
        }
Beispiel #2
0
        public void AddBinaryReturnDecimal(int[] argInts, int result)
        {
            var output = new NumberWithBase(0, 2);

            output = argInts.Aggregate(output, (current, argInt) => current + new NumberWithBase(argInt, 2));
            output.ChangeBase(10);
            Assert.AreEqual(result, output.Value);
        }