Exemplo n.º 1
0
        public void LabelFinder_OnlyFindsTheFirstLabel_IfThereAreTwoLabelsToTheSameLine_HopefullyThisIsntAProblem()
        {
            string pretemplate = @"0: LDC 6, 9(0) ; set registers 6 to value 9
101: LDA 7, [label0](0)  ; jump to label label0

102: LDC 1, 1(0)     ; load constant into r1
103: OUT 1, 0, 0           ; write out contens of r1
* label:label0
* label:label1
104: LDC 1, 2(0)     ; load constant into r1
105: OUT 1, 0, 0           ; write out contens of r1";

            var dictionary = LabelFinder.FindLabels(pretemplate);

            Assert.That(dictionary.Count, Is.EqualTo(1));
            Assert.That(dictionary["label0"], Is.EqualTo("104"));
        }
Exemplo n.º 2
0
        public void LabelFinder_ShouldWorkWithBigLineNumbers()
        {
            string pretemplate = @"0: LDC 6, 9(0) ; set registers 6 to value 9
101: LDA 7, [label0](0)  ; jump to label label0

102: LDC 1, 1(0)     ; load constant into r1
103: OUT 1, 0, 0           ; write out contens of r1
* label:label0

104: LDC 1, 2(0)     ; load constant into r1
105: OUT 1, 0, 0           ; write out contens of r1";

            var dictionary = LabelFinder.FindLabels(pretemplate);

            Assert.That(dictionary.Count, Is.EqualTo(1));
            Assert.That(dictionary["label0"], Is.EqualTo("104"));
        }