Esempio n. 1
0
        public void fromRomanAssert()
        {
            Assert.AreEqual(Roman.fromRoman("I"), 1);
            Assert.AreEqual(Roman.fromRoman("II"), 2);
            Assert.AreEqual(Roman.fromRoman("III"), 3);
            Assert.AreEqual(Roman.fromRoman("IV"), 4);
            Assert.AreEqual(Roman.fromRoman("V"), 5);
            Assert.AreEqual(Roman.fromRoman("VI"), 6);
            Assert.AreEqual(Roman.fromRoman("VII"), 7);
            Assert.AreEqual(Roman.fromRoman("VIII"), 8);
            Assert.AreEqual(Roman.fromRoman("IX"), 9);
            Assert.AreEqual(Roman.fromRoman("X"), 10);
            Assert.AreEqual(Roman.fromRoman("L"), 50);
            Assert.AreEqual(Roman.fromRoman("C"), 100);
            Assert.AreEqual(Roman.fromRoman("D"), 500);
            Assert.AreEqual(Roman.fromRoman("M"), 1000);

            Assert.AreEqual(Roman.fromRoman("CXLVIII"), 148);
            Assert.AreEqual(Roman.fromRoman("DCCLXXXII"), 782);
            Assert.AreEqual(Roman.fromRoman("MDCCLIV"), 1754);
            Assert.AreEqual(Roman.fromRoman("MDCCCXXXII"), 1832);
            Assert.AreEqual(Roman.fromRoman("MMMDCCCXLIV"), 3844);
            Assert.AreEqual(Roman.fromRoman("MMMDCCCLXXXVIII"), 3888);
            Assert.AreEqual(Roman.fromRoman("MMMCMXCIX"), 3999);
            Assert.AreEqual(Roman.fromRoman("MMMMCMXCIX"), 4999);
        }
Esempio n. 2
0
 public void is_correct()
 {
     foreach (int number in Enumerable.Range(0, 3999))
     {
         bool isReversable = Roman.fromRoman(Roman.toRoman(number)) == number;
         Assert.That(
             condition: isReversable,
             message: $"Couldn't successfully convert {number} back and forth"
             );
     }
 }
Esempio n. 3
0
 public void negativeZeroCheck()
 {
     Assert.IsFalse(Roman.fromRoman("") < 0, "negative numbers are rejected");
 }
Esempio n. 4
0
 public void fromRomanTests_160()
 {
     Assert.AreEqual(160, Roman.fromRoman("CLX"));
 }
Esempio n. 5
0
 public void fromRomanTests_100()
 {
     Assert.AreEqual(100, Roman.fromRoman("C"));
 }
Esempio n. 6
0
 public void fromRomanTests_88()
 {
     Assert.AreEqual(88, Roman.fromRoman("LXXXVIII"));
 }
Esempio n. 7
0
 public void fromRomanTests_50()
 {
     Assert.AreEqual(50, Roman.fromRoman("L"));
 }
Esempio n. 8
0
 public void fromRomanTests_29()
 {
     Assert.AreEqual(29, Roman.fromRoman("XXIX"));
 }
Esempio n. 9
0
 public void fromRomanTests_5()
 {
     Assert.AreEqual(5, Roman.fromRoman("V"));
 }
Esempio n. 10
0
 public void fromRomanTests_1()
 {
     Assert.AreEqual(1, Roman.fromRoman("I"));
 }
Esempio n. 11
0
        public void TestMethod1()
        {
            int res = Roman.fromRoman("I");

            Assert.AreEqual(1, res);
        }
Esempio n. 12
0
        public void fromRomanTest()
        {
            int res = Roman.fromRoman("L");

            Assert.AreEqual(50, res);
        }
Esempio n. 13
0
 public void typeCheck()
 {
     Assert.IsInstanceOfType(Roman.fromRoman("I"), typeof(int), "Bad instance of return, should be Integer");
 }
Esempio n. 14
0
 public void emptyCheck()
 {
     Assert.IsNotNull(Roman.fromRoman("I"), "returned empty value");
 }
Esempio n. 15
0
 public void fromRomanTests_4()
 {
     Assert.AreEqual(4, Roman.fromRoman("IV"));
 }
Esempio n. 16
0
 public void addRomanTests_n3999_nr1()
 {
     Assert.AreEqual("IV", Roman.addRoman(Roman.toRoman(3999), Roman.toRoman(Roman.fromRoman("I"))));
 }
Esempio n. 17
0
 public void fromRomanTests_999()
 {
     Assert.AreEqual(999, Roman.fromRoman("CMXCIX"));
 }
Esempio n. 18
0
 public void fromRomanTests_9()
 {
     Assert.AreEqual(9, Roman.fromRoman("IX"));
 }
Esempio n. 19
0
 public void fromRomanTests_1500()
 {
     Assert.AreEqual(1500, Roman.fromRoman("MD"));
 }
Esempio n. 20
0
 public void fromRomanTests_49()
 {
     Assert.AreEqual(49, Roman.fromRoman("XLIX"));
 }
Esempio n. 21
0
 public void fromRomanTests_1800()
 {
     Assert.AreEqual(1800, Roman.fromRoman("MDCCC"));
 }
Esempio n. 22
0
 public void fromRomanTests_83()
 {
     Assert.AreEqual(83, Roman.fromRoman("LXXXIII"));
 }
Esempio n. 23
0
 public void fromRomanTests_2500()
 {
     Assert.AreEqual(2500, Roman.fromRoman("MMC"));
 }
Esempio n. 24
0
 public void fromRomanTests_90()
 {
     Assert.AreEqual(90, Roman.fromRoman("XC"));
 }
Esempio n. 25
0
 public void fromRomanTests_3000()
 {
     Assert.AreEqual(3000, Roman.fromRoman("MMM"));
 }
Esempio n. 26
0
 public void fromRomanTests_110()
 {
     Assert.AreEqual(110, Roman.fromRoman("CX"));
 }
Esempio n. 27
0
 public void fromRomanTests_3999()
 {
     Assert.AreEqual(3999, Roman.fromRoman("MMMCMXCIX"));
 }
Esempio n. 28
0
 public void fromRomanTests_3()
 {
     Assert.AreEqual(3, Roman.fromRoman("III"));
 }
Esempio n. 29
0
 public void upperBoundCheck()
 {
     Assert.IsFalse(Roman.fromRoman("") > 4999, "number is too big");
 }