public void SimpleFunctionType_ParseCheck() { var returnVal = new LValueRef(LType.F32Type(), ""); var parameter = new LPointerRef(new LValueRef(LType.F32Type(), ""), ""); LFunctionType fnType = new LFunctionType(returnVal, parameter); Assert.AreEqual("float (float*)", fnType.Parse()); }
public void SimpleAnd_FloatingPointResultType_Expected_Exception() { LAnd and; Assert.Throws <Exception>(() => and = new LAnd(new LValueRef(LType.F32Type(), "%result"), _valueOp1, _valueOp2) ); }
public void SimpleLshr_FloatingPointResultType_Expected_Exception() { LShl shl; Assert.Throws <Exception>(() => shl = new LShl(new LValueRef(LType.F32Type(), "%result"), _valueOp1, _valueOp2) ); }
public void SimpleXor_FloatingPointResultType_Expected_Exception() { LXor xor; Assert.Throws <Exception>(() => xor = new LXor(new LValueRef(LType.F32Type(), "%result"), _valueOp1, _valueOp2) ); }
public void SimpleFunctionType_ArrayAsReturnVal_Expected_Exception() { var returnVal = new LArrayRef("", new LValueRef(LType.F32Type(), ""), 5); LFunctionType fnType; Assert.Throws<Exception>(() => fnType = new LFunctionType(returnVal) ); }
public void SimpleFneg_ResultHasNoIdentifier_Exception() { LFneg fneg; Assert.Throws <Exception>(() => fneg = new LFneg(_op1, new LValueRef(LType.F32Type(), "1.000000e+00")) ); }
public void VarargFunctionType_ParseCheck() { var returnVal = new LValueRef(LType.F32Type(), ""); var parameter = new LPointerRef(new LValueRef(LType.F32Type(), ""), ""); LFunctionType fnType = new LFunctionType(returnVal, parameter) { HasVararg = true }; Assert.AreEqual("float (float*, ...)", fnType.Parse()); }
public void AdvancedLabel_RegisterInstructionByLabelTest_LabelNotFound_Exception() { var func = LFunction.Create("foo_function", new LValueRef(LType.Int32Type(), "")); var label1 = func.Register(new LLabelType("entry")); var label2 = new LLabelType("label2"); Assert.Throws <Exception>(() => { var alloca = func.Register(new LAlloca(func, LType.F32Type())); var pointerRef = alloca.PointerRef; var load = func.Register(label2, new LLoad(func, pointerRef)); }); }
public void SimpleLabel_RegisterInstructionTest_NoException() { var func = LFunction.Create("foo_function", new LValueRef(LType.Int32Type(), "")); func.Register(new LLabelType("entry")); Assert.DoesNotThrow(() => { var alloca = func.Register(new LAlloca(func, LType.F32Type())); var pointerRef = alloca.PointerRef; var load = func.Register(new LLoad(func, pointerRef)); }); }