public void TestWithTooManyParamsIntInt() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0), ctx.GetRefEval(0, 1), ctx.GetRefEval(0, 1) }; ValueEval result = new Dec2Bin().Evaluate(args, -1, -1); Assert.AreEqual(typeof(ErrorEval), result.GetType()); Assert.AreEqual(ErrorEval.VALUE_INVALID, result); }
public void TestWithToshortPlaces() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0), ctx.GetRefEval(0, 3) }; ValueEval result = new Dec2Bin().Evaluate(args, -1, -1); Assert.AreEqual(typeof(ErrorEval), result.GetType()); Assert.AreEqual(ErrorEval.NUM_ERROR, result); }
public void TestWithPlaces() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0), ctx.GetRefEval(0, 1) }; ValueEval result = new Dec2Bin().Evaluate(args, ctx); Assert.AreEqual(typeof(StringEval), result.GetType(), "Had: " + result.ToString()); // TODO: documentation and behavior do not match here! Assert.AreEqual("1101", ((StringEval)result).StringValue); }
public void TestEvalOperationEvaluationContext() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0) }; ValueEval result = new Hex2Dec().Evaluate(args, ctx); Assert.AreEqual(typeof(NumberEval), result.GetType()); Assert.AreEqual("0", ((NumberEval)result).StringValue); }
public void TestWithErrorPlaces() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0), ErrorEval.NULL_INTERSECTION }; ValueEval result = new Dec2Bin().Evaluate(args, -1, -1); Assert.AreEqual(typeof(ErrorEval), result.GetType()); Assert.AreEqual(ErrorEval.NULL_INTERSECTION, result); }
public void TestRefs() { OperationEvaluationContext ctx = CreateContext(); ValueEval[] args = new ValueEval[] { ctx.GetRefEval(0, 0) }; ValueEval result = new Dec2Bin().Evaluate(args, -1, -1); Assert.AreEqual(result.GetType(), typeof(StringEval), "Had: " + result.ToString()); Assert.AreEqual("1101", ((StringEval)result).StringValue); }