Example #1
0
        public void ConditionalBr_TypeCheck_i8_Success()
        {
            LConditionalBr conditionalBr;

            Assert.DoesNotThrow(() =>
                                conditionalBr = new LConditionalBr(
                                    new LValueRef(LType.BoolType(), _function.GetValueRefIdentifier()),
                                    _ifTrueLabel, _ifFalseLabel)
                                );
        }
Example #2
0
        public void ConditionalBr_ParseCheck()
        {
            LValueRef      condition     = new LValueRef(LType.BoolType(), _function.GetValueRefIdentifier());
            LConditionalBr conditionalBr = new LConditionalBr(
                condition, _ifTrueLabel, _ifFalseLabel);

            Assert.AreEqual(
                $"{LKeywords.Br} i1 {condition.ValueOrIdentifier}, {LKeywords.Label} {_ifTrueLabel.Identifier}, {LKeywords.Label} {_ifFalseLabel.Identifier}",
                LHelper.Trim(conditionalBr.ParseInstruction()));
        }
Example #3
0
        public void ConditionalBr_TypeCheck_i32_Exception()
        {
            LConditionalBr conditionalBr;

            Assert.Throws <Exception>(() =>
                                      conditionalBr = new LConditionalBr(
                                          new LValueRef(LType.Int32Type(), _function.GetValueRefIdentifier()),
                                          _ifTrueLabel, _ifFalseLabel)
                                      );
        }