Exemple #1
0
        public void AnotherFailingTestsInKata()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("[*>[>*>]>]", "11001");

            Assert.That(result, Is.EqualTo("01100"));
        }
Exemple #2
0
        public void BrokeSomethingAgain()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("*>*>>>*>*>>>>>*[>*]", "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");

            Assert.That(result, Is.EqualTo("1100110000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"));
        }
Exemple #3
0
        public void FlippingCodeShouldFlipTape()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("*", "00101100");

            Assert.That(result, Is.EqualTo("10101100"));
        }
Exemple #4
0
        public void FailingTestsInKata()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("[[]*>*>*>]", "000");

            Assert.That(result, Is.EqualTo("000"));
        }
Exemple #5
0
        public void JumpPastBracketIfZero()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("*>[>*]*", "00101100");

            Assert.That(result, Is.EqualTo("11101100"));
        }
Exemple #6
0
        public void FlipsOneBits()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile(">>>>>*<*<<*", "00101100");

            Assert.That(result, Is.EqualTo("00000000"));
        }
Exemple #7
0
        public void FlipsZeroBits()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("*>*>>*>>>*>*", "00101100");

            Assert.That(result, Is.EqualTo("11111111"));
        }
Exemple #8
0
        public void FlipsSecondAndThirdPositionOfTheCell()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile(">*>*", "00101100");

            Assert.That(result, Is.EqualTo("01001100"));
        }
Exemple #9
0
        public void LoopShouldExecuteProperly()
        {
            var interpreter = new SmallFuck();
            var result      = interpreter.Compile("*[>*]",
                                                  "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");

            Assert.That(result,
                        Is.EqualTo(
                            "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"));
        }