public static void InterpretTest(Context context, String testName) { TestMethodDeclaration test = context.getTest(testName); Context local = context.newLocalContext(); test.interpret(local); }
public bool interpretAssert(Context context, TestMethodDeclaration test) { IValue lval = left.interpret(context); if (!(lval is BooleanValue)) { throw new SyntaxError("Illegal: " + lval.GetType().Name + " and ..., expected a Boolean"); } IValue rval = lval; if (((BooleanValue)lval).Value) { rval = right.interpret(context); if (!(rval is BooleanValue)) { throw new SyntaxError("Illegal: " + lval.GetType().Name + " and " + rval.GetType().Name); } } if (rval == BooleanValue.TRUE) { return(true); } CodeWriter writer = new CodeWriter(test.Dialect, context); this.ToDialect(writer); String expected = writer.ToString(); String actual = lval + operatorToDialect(test.Dialect) + rval; test.printAssertionFailed(context, expected, actual); return(false); }
public void registerDeclaration(TestMethodDeclaration declaration) { if (tests.ContainsKey(declaration.GetName())) { throw new SyntaxError("Duplicate test: \"" + declaration.GetName() + "\""); } tests[declaration.GetName()] = declaration; }
public bool interpretAssert(Context context, TestMethodDeclaration testMethodDeclaration) { IValue value = this.interpret(context); if (value is prompto.value.BooleanValue) { return(((prompto.value.BooleanValue)value).Value); } else { CodeWriter writer = new CodeWriter(this.Dialect, context); this.ToDialect(writer); throw new SyntaxError("Cannot test '" + writer.ToString() + "'"); } }
public bool interpretAssert(Context context, TestMethodDeclaration testMethodDeclaration) { if (resolved == null) { resolveAndCheck(context); } if (resolved is IAssertion) { return(((IAssertion)resolved).interpretAssert(context, testMethodDeclaration)); } else { CodeWriter writer = new CodeWriter(this.Dialect, context); resolved.ToDialect(writer); throw new SyntaxError("Cannot test '" + writer.ToString() + "'"); } }
public bool interpretAssert(Context context, TestMethodDeclaration test) { IValue val = expression.interpret(context); IValue result = interpret(val); if (result == BooleanValue.TRUE) { return(true); } CodeWriter writer = new CodeWriter(test.Dialect, context); this.ToDialect(writer); String expected = writer.ToString(); String actual = operatorToDialect(test.Dialect) + val.ToString(); test.printAssertionFailed(context, expected, actual); return(false); }
public bool interpretAssert(Context context, TestMethodDeclaration test) { IValue lval = left.interpret(context); IValue rval = right.interpret(context); IValue result = compare(context, lval, rval); if (result == BooleanValue.TRUE) { return(true); } CodeWriter writer = new CodeWriter(test.Dialect, context); this.ToDialect(writer); String expected = writer.ToString(); String actual = lval.ToString() + " " + oper.ToString() + " " + rval.ToString(); test.printAssertionFailed(context, expected, actual); return(false); }