/** * Same as test_throws() but for three messages. */ void test_throws(const std::string& model_name, const std::string& error_msg1, const std::string& error_msg2, const std::string& error_msg3) { test_throws(model_name, error_msg1); test_throws(model_name, error_msg2); test_throws(model_name, error_msg3); }
TEST(langParserForLoop, BadIndices) { test_throws("for_loops/for_statements_bad_indices0", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/for_statements_bad_indices1", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/for_statements_bad_indices2", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/for_statements_bad_indices3", "Loop must be over container or range."); test_throws("for_loops/for_statements_bad_indices4", "Loop variable already declared."); }
TEST(lang_parser, integrate_ode_bdf_control_bad) { test_throws("ode/bad_fun_type_bdf_control", "first argument to integrate_ode_bdf must be a function with signature"); test_throws("ode/bad_y_type_bdf_control", "second argument to integrate_ode_bdf must have type real[]"); test_throws("ode/bad_t_type_bdf_control", "third argument to integrate_ode_bdf must have type real or int"); test_throws("ode/bad_ts_type_bdf_control", "fourth argument to integrate_ode_bdf must have type real[]"); test_throws("ode/bad_theta_type_bdf_control", "fifth argument to integrate_ode_bdf must have type real[]"); test_throws("ode/bad_x_type_bdf_control", "sixth argument to integrate_ode_bdf must have type real[]"); test_throws("ode/bad_x_int_type_bdf_control", "seventh argument to integrate_ode_bdf must have type int[]"); test_throws("ode/bad_t0_var_type_bdf_control", "third argument to integrate_ode_bdf (initial times) must be data only"); test_throws("ode/bad_ts_var_type_bdf_control", "fourth argument to integrate_ode_bdf (solution times) must be data only"); test_throws("ode/bad_x_var_type_bdf_control", "fifth argument to integrate_ode_bdf (real data) must be data only"); }
TEST(langParserForLoop, BadLoopVarAssign) { test_throws("for_loops/assign_to_loop_var1", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var2", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var3", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var4", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var5", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var6", "Loop variable v cannot be used on left side of assignment statement"); test_throws("for_loops/assign_to_loop_var7", "Loop variable v cannot be used on left side of assignment statement"); }
TEST(parserFunctions, funsBad1) { test_throws("functions-bad1","Function already declared"); }
TEST(parserFunctions, funsBad0) { test_throws("functions-bad0","Functions cannot contain void argument types"); }
TEST(langParser, functionSigErrorsSampUnknown) { test_throws("signature_sampling_unknown", "No matches for:", "vector ~ foo_whatev(vector)", "Distribution foo_whatev not found."); }
TEST(parserFunctions,funsBad15) { test_throws("functions-bad15", "attempt to increment log prob with void expression"); }
TEST(parserFunctions,funsBad13) { test_throws("functions-bad13", "Illegal to assign to function argument variables"); }
TEST(parserFunctions,funsBad7) { test_throws("functions-bad7", "Function target() or functions suffixed with _lp only" " allowed in transformed parameter block, model block"); }
TEST(parserFunctions,funsBad4) { test_throws("functions-bad4", "Functions used as statements must be declared to have void returns"); }
TEST(parserFunctions,funsBad10) { test_throws("functions-bad10", "random number generators only allowed in"); }
TEST(parserFunctions,funsBad7) { test_throws("functions-bad7", "lp suffixed functions only allowed in"); }
TEST(parserFunctions,funsBad17) { test_throws("functions-bad17", "Require real return type for functions ending in _log"); }
TEST(langParser, printVoidBad) { test_throws("print-void", "ERROR: expected printable (non-void) expression."); }
TEST(langParser, functionSigErrorsFunKnown) { test_throws("signature_function_known", "No matches for:", "bernoulli_logit_log(vector, vector)", "Available argument signatures for bernoulli_logit_log:"); }
TEST(langParser, functionSigErrorsFunUnknown) { test_throws("signature_function_unknown", "No matches for:", " foo_whatev_log(vector, vector)", "Function foo_whatev_log not found."); }
TEST(langParser, functionSigErrorsSampKnown) { test_throws("signature_sampling_known", "No matches for:", "vector ~ bernoulli_logit(vector)", "Available argument signatures for bernoulli_logit:"); }
TEST(parserFunctions, funsBad2) { test_throws("functions-bad2","Function declared, but not defined"); }
TEST(parserFunctions, funsBad3) { test_throws("functions-bad3","SYNTAX ERROR, MESSAGE(S) FROM PARSER:"); }
TEST(langParserExpressionGrammarDef, conditionalOpBad1) { test_throws("validate_conditional_op_bad-1", "Condition in ternary expression must be primitive int;"); }
TEST(parserFunctions,funsBad5) { test_throws("functions-bad5", "base type mismatch in assignment"); }
TEST(langParserExpressionGrammarDef, conditionalOpBad2) { test_throws("validate_conditional_op_bad-2", "Type mismatch in ternary expression, expression when true is:"); }
TEST(parserFunctions,funsBad12) { test_throws("functions-bad12", "Sampling statements (~) and increment_log_prob()"); }
TEST(parserFunctions,funsBad17) { test_throws("functions-bad17", "Require real return type for probability functions" " ending in _log, _lpdf, _lpmf, _lcdf, or _lccdf."); }
TEST(parserFunctions,funsBad14) { test_throws("functions-bad14", "Function already defined"); }
TEST(parserFunctions, funsBad18) { test_throws("functions-bad18","variable identifier (name) may not be reserved word"); }
TEST(parserFunctions,funsBad16) { test_throws("functions-bad16", "Function system defined"); }
TEST(LangGrammarsIndexing, badRealIdx) { test_throws("real_idx", "Container index must be integer; found type=real"); test_throws("real_idx", "PARSER EXPECTED: <one or more container indexes followed by ']'>"); }