Ejemplo n.º 1
0
/**
 * 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);
}
Ejemplo n.º 2
0
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.");
}
Ejemplo n.º 3
0
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");
}
Ejemplo n.º 4
0
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");
}
Ejemplo n.º 5
0
TEST(parserFunctions, funsBad1) {
  test_throws("functions-bad1","Function already declared");
}
Ejemplo n.º 6
0
TEST(parserFunctions, funsBad0) {
  test_throws("functions-bad0","Functions cannot contain void argument types");
}
Ejemplo n.º 7
0
TEST(langParser, functionSigErrorsSampUnknown) {
    test_throws("signature_sampling_unknown",
                "No matches for:",
                "vector ~ foo_whatev(vector)",
                "Distribution foo_whatev not found.");
}
Ejemplo n.º 8
0
TEST(parserFunctions,funsBad15) {
  test_throws("functions-bad15",
              "attempt to increment log prob with void expression");
}
Ejemplo n.º 9
0
TEST(parserFunctions,funsBad13) {
  test_throws("functions-bad13",
              "Illegal to assign to function argument variables");
}
Ejemplo n.º 10
0
TEST(parserFunctions,funsBad7) {
  test_throws("functions-bad7",
              "Function target() or functions suffixed with _lp only"
              " allowed in transformed parameter block, model block");
}
Ejemplo n.º 11
0
TEST(parserFunctions,funsBad4) {
  test_throws("functions-bad4",
              "Functions used as statements must be declared to have void returns");
}
Ejemplo n.º 12
0
TEST(parserFunctions,funsBad10) {
  test_throws("functions-bad10",
              "random number generators only allowed in");
}
Ejemplo n.º 13
0
TEST(parserFunctions,funsBad7) {
  test_throws("functions-bad7",
              "lp suffixed functions only allowed in");
}
Ejemplo n.º 14
0
TEST(parserFunctions,funsBad17) {
  test_throws("functions-bad17",
              "Require real return type for functions ending in _log");
}
Ejemplo n.º 15
0
TEST(langParser, printVoidBad) {
  test_throws("print-void", 
              "ERROR:  expected printable (non-void) expression.");
}
Ejemplo n.º 16
0
TEST(langParser, functionSigErrorsFunKnown) {
    test_throws("signature_function_known",
                "No matches for:",
                "bernoulli_logit_log(vector, vector)",
                "Available argument signatures for bernoulli_logit_log:");
}
Ejemplo n.º 17
0
TEST(langParser, functionSigErrorsFunUnknown) {
    test_throws("signature_function_unknown",
                "No matches for:",
                "  foo_whatev_log(vector, vector)",
                "Function foo_whatev_log not found.");
}
Ejemplo n.º 18
0
TEST(langParser, functionSigErrorsSampKnown) {
    test_throws("signature_sampling_known",
                "No matches for:",
                "vector ~ bernoulli_logit(vector)",
                "Available argument signatures for bernoulli_logit:");
}
Ejemplo n.º 19
0
TEST(parserFunctions, funsBad2) {
  test_throws("functions-bad2","Function declared, but not defined");
}
Ejemplo n.º 20
0
TEST(parserFunctions, funsBad3) {
  test_throws("functions-bad3","SYNTAX ERROR, MESSAGE(S) FROM PARSER:");
}
Ejemplo n.º 21
0
TEST(langParserExpressionGrammarDef, conditionalOpBad1) {
  test_throws("validate_conditional_op_bad-1",
              "Condition in ternary expression must be primitive int;");
}
Ejemplo n.º 22
0
TEST(parserFunctions,funsBad5) {
  test_throws("functions-bad5",
              "base type mismatch in assignment");
}
Ejemplo n.º 23
0
TEST(langParserExpressionGrammarDef, conditionalOpBad2) {
  test_throws("validate_conditional_op_bad-2",
              "Type mismatch in ternary expression, expression when true is:");
}
Ejemplo n.º 24
0
TEST(parserFunctions,funsBad12) {
  test_throws("functions-bad12",
              "Sampling statements (~) and increment_log_prob()");
}
Ejemplo n.º 25
0
TEST(parserFunctions,funsBad17) {
  test_throws("functions-bad17",
              "Require real return type for probability functions"
              " ending in _log, _lpdf, _lpmf, _lcdf, or _lccdf.");
}
Ejemplo n.º 26
0
TEST(parserFunctions,funsBad14) {
  test_throws("functions-bad14",
              "Function already defined");
}
Ejemplo n.º 27
0
TEST(parserFunctions, funsBad18) {
  test_throws("functions-bad18","variable identifier (name) may not be reserved word");
}
Ejemplo n.º 28
0
TEST(parserFunctions,funsBad16) {
  test_throws("functions-bad16",
              "Function system defined");
}
Ejemplo n.º 29
0
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 ']'>");
}