示例#1
0
        public void TestToStringError()
        {
            var fixnum = new Fixnum(10000);

            Assert.Throws <ArgumentError>(() => { fixnum.ToString(1); });
            Assert.Throws <ArgumentError>(() => { fixnum.ToString(37); });
        }
示例#2
0
        public void TestToString()
        {
            Assert.That(new Fixnum().ToString(), Is.EqualTo("0"));
            Assert.That(new Fixnum(-100).ToString(16), Is.EqualTo("-64"));

            var fixnum = new Fixnum(257);

            Assert.That(fixnum.ToString(), Is.EqualTo("257"));
            Assert.That(fixnum.ToString(2), Is.EqualTo("100000001"));
            Assert.That(fixnum.ToString(8), Is.EqualTo("401"));
            Assert.That(fixnum.ToString(16), Is.EqualTo("101"));
            Assert.That(fixnum.ToString(13), Is.EqualTo("16a"));
            Assert.That(fixnum.ToString(36), Is.EqualTo("75"));
        }
示例#3
0
        public void TestInspect([Random(long.MinValue, long.MaxValue, 3)] long value)
        {
            var fixnum = new Fixnum(value);

            Assert.That(fixnum.Inspect(), Is.EqualTo(fixnum.ToString()));
        }