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

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

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

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

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

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

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

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

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

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