Example #1
0
void Explanation_Based_Chunker::add_additional_constraints()
{
    constraint* lConstraint = NULL;
    test eq_copy = NULL, constraint_test = NULL;

    for (constraint_list::iterator iter = constraints->begin(); iter != constraints->end();)
    {
        lConstraint = *iter;
        condition* lOperationalCond = lConstraint->eq_test->identity ? lConstraint->eq_test->identity->get_operational_cond() : NULL;
        condition* lOperationalConstraintCond = lConstraint->constraint_test->identity ? lConstraint->constraint_test->identity->get_operational_cond() : NULL;

        if (lOperationalCond && !lConstraint->eq_test->identity->literalized())
        {
            constraint_test = copy_test(thisAgent, lConstraint->constraint_test, true);
            attach_relational_test(constraint_test, lOperationalCond, lConstraint->eq_test->identity->get_operational_field());
        }
        else if (lOperationalConstraintCond && !lConstraint->constraint_test->identity->literalized())
        {
            eq_copy = copy_test(thisAgent, lConstraint->eq_test, true);
            constraint_test = copy_test(thisAgent, lConstraint->constraint_test, true);
            invert_relational_test(&eq_copy, &constraint_test);
            attach_relational_test(constraint_test, lOperationalConstraintCond, lConstraint->constraint_test->identity->get_operational_field());
            deallocate_test(thisAgent, eq_copy);
        }
        ++iter;
    }
    clear_cached_constraints();
}
Example #2
0
// Argument: pass name of a file with at least 2000 lines of text entries (words)
int main(int argc, char* argv[])
{
	int errors = argc - argc;  // 0

	REPORT_CHECK(basic_insertion_test<char>());
	REPORT_CHECK(basic_insertion_test<wchar_t>());
	REPORT_CHECK(element_range_test<char>());
	REPORT_CHECK(element_range_test<wchar_t>());

	REPORT_CHECK(mapped_value_test());
	REPORT_CHECK(copy_test());

	REPORT_CHECK(localization_test());
	REPORT_CHECK(iterator_test(argv[1]));
	REPORT_CHECK(erase_test(argv[1]));

	REPORT_CHECK(prefix_range_test(argv[1]));
	REPORT_CHECK(longest_match_test());
	REPORT_CHECK(partial_match_test(argv[1]));
	REPORT_CHECK(hamming_search_test(argv[1]));
	REPORT_CHECK(levenshtein_search_test());
	REPORT_CHECK(scrabble_search_test(argv[1]));

	return errors;
}
Example #3
0
int main( )
{
    int rc = 0;
    //heap_dump();
    int original_count = heap_count( );
    
    try {
        if( !construct_test( )  || !heap_ok( "t1" ) ) rc = 1;
        if( !access_test( )     || !heap_ok( "t2" ) ) rc = 1;
        //if( !string_test( )     || !heap_ok( "t3" ) ) rc = 1;
        //if( !torture_test( )    || !heap_ok( "t4" ) ) rc = 1;
        //if( !clear_test( )      || !heap_ok( "t5" ) ) rc = 1;
        if( !iterator_test( )   || !heap_ok( "t6" ) ) rc = 1;
        if( !copy_test( )       || !heap_ok( "t7" ) ) rc = 1;
        if( !allocator_test( )  || !heap_ok( "t8" ) ) rc = 1;
        if( !bounds_test( )     || !heap_ok( "t9" ) ) rc = 1;
        if( !hint_ins_test( )   || !heap_ok( "tA" ) ) rc = 1;
    }
    catch( ... ) {
        std::cout << "Unexpected exception of unexpected type.\n";
        rc = 1;
    }
    int heap_diff = heap_count( ) - original_count;
    if( heap_diff ) {
        heap_dump();
        std::cout << "Possible memory leak! " << heap_diff << " " << original_count << "\n";
        rc = 1;
    }
    
    return( rc );
}
Example #4
0
int main() {
	operator_test();
	insert_and_find_test();
	copy_test();
	iterator_operator_plus();
	iterator_operator_minus();
	clear();
	erase_iterator();
	erase_key();
}
Example #5
0
int main(void)
{
  static struct dstring ds;

  initfree_test(&ds);
  cat_test(&ds);
  copy_test(&ds);
  chop_test(&ds);

  return 0;
}
Example #6
0
void Explanation_Based_Chunker::add_additional_constraints()
{
    constraint* lConstraint = NULL;
    test eq_copy = NULL, constraint_test = NULL;

    dprint_header(DT_CONSTRAINTS, PrintBefore, "Adding %u transitive constraints from non-operational conditions...\n", static_cast<uint64_t>(constraints->size()));

    for (constraint_list::iterator iter = constraints->begin(); iter != constraints->end();)
    {
        lConstraint = *iter;
        condition* lOperationalCond = lConstraint->eq_test->identity ? lConstraint->eq_test->identity->get_operational_cond() : NULL;
        condition* lOperationalConstraintCond = lConstraint->constraint_test->identity ? lConstraint->constraint_test->identity->get_operational_cond() : NULL;
        dprint(DT_CONSTRAINTS, "Attempting to add constraint %t %g to %t %g: ", lConstraint->constraint_test, lConstraint->constraint_test, lConstraint->eq_test, lConstraint->eq_test);

        if (lOperationalCond && !lConstraint->eq_test->identity->literalized())
        {
            constraint_test = copy_test(thisAgent, lConstraint->constraint_test, true);
            attach_relational_test(constraint_test, lOperationalCond, lConstraint->eq_test->identity->get_operational_field());
            dprint(DT_CONSTRAINTS, "...constraint added.  Condition is now %l\n", lOperationalCond);
        }
        else if (lOperationalConstraintCond && !lConstraint->constraint_test->identity->literalized())
        {
            eq_copy = copy_test(thisAgent, lConstraint->eq_test, true);
            constraint_test = copy_test(thisAgent, lConstraint->constraint_test, true);
            invert_relational_test(&eq_copy, &constraint_test);
            attach_relational_test(constraint_test, lOperationalConstraintCond, lConstraint->constraint_test->identity->get_operational_field());
            deallocate_test(thisAgent, eq_copy);
            dprint(DT_CONSTRAINTS, "...complement of constraint added.  Condition is now %l\n", lOperationalConstraintCond);
        } else {
            dprint(DT_CONSTRAINTS, "...did not add constraint:\n    eq_test: %t %g, literalized = %s\n    reltest: %t %g, literalized = %s\n",
                lConstraint->eq_test, lConstraint->eq_test, (lConstraint->eq_test->identity && lConstraint->eq_test->identity->literalized()) ? "true" : "false",
                    lConstraint->constraint_test, lConstraint->constraint_test, (lConstraint->constraint_test->identity && lConstraint->constraint_test->identity->literalized()) ? "true" : "false");
        }
        ++iter;
    }
    clear_cached_constraints();

    dprint_header(DT_CONSTRAINTS, PrintAfter, "Done adding transitive constraints.\n");
}
Example #7
0
int main(int argc, char *argv[]) {
  grpc_test_init(argc, argv);
  empty_test();
  basic_test();
  lookup_by_key_test();
  invalid_test();
  copy_test();
  replace_value_test();
  replace_flags_test();
  delete_tag_test();
  add_tag_test();
  replace_add_delete_test();
  encode_decode_test();
  return 0;
}
Example #8
0
int main( )
{
  int rc = 0;
  int original_count = heap_count( );

  try {
    if( !construct_test( )         || !heap_ok( "t01" ) ) rc = 1;
    if( !assign_test( )            || !heap_ok( "t02" ) ) rc = 1;
    if( !access_test( )            || !heap_ok( "t03" ) ) rc = 1;
    if( !relational_test( )        || !heap_ok( "t04" ) ) rc = 1;
    if( !capacity_test( )          || !heap_ok( "t05" ) ) rc = 1;
    if( !iterator_test( )          || !heap_ok( "t06" ) ) rc = 1;
    if( !append_test( )            || !heap_ok( "t07" ) ) rc = 1;
    if( !insert_test( )            || !heap_ok( "t08" ) ) rc = 1;
    if( !erase_test( )             || !heap_ok( "t09" ) ) rc = 1;
    if( !replace_test( )           || !heap_ok( "t10" ) ) rc = 1;
    if( !iterator_replace_test( )  || !heap_ok( "t11" ) ) rc = 1;
    if( !copy_test( )              || !heap_ok( "t12" ) ) rc = 1;
    if( !swap_test( )              || !heap_ok( "t13" ) ) rc = 1;
    if( !cstr_test( )              || !heap_ok( "t14" ) ) rc = 1;
    if( !find_test( )              || !heap_ok( "t15" ) ) rc = 1;
    if( !rfind_test( )             || !heap_ok( "t16" ) ) rc = 1;
    if( !find_first_of_test( )     || !heap_ok( "t17" ) ) rc = 1;
    if( !find_last_of_test( )      || !heap_ok( "t18" ) ) rc = 1;
    if( !find_first_not_of_test( ) || !heap_ok( "t19" ) ) rc = 1;
    if( !find_last_not_of_test( )  || !heap_ok( "t20" ) ) rc = 1;
    if( !substr_test( )            || !heap_ok( "t21" ) ) rc = 1;
  }
  catch( std::out_of_range e ) {
    std::cout << "Unexpected out_of_range exception: " << e.what( ) << "\n";
    rc = 1;
  }
  catch( std::length_error e ) {
    std::cout << "Unexpected length_error exception: " << e.what( ) << "\n";
    rc = 1;
  }
  catch( ... ) {
    std::cout << "Unexpected exception of unexpected type.\n";
    rc = 1;
  }

  if( heap_count( ) != original_count ) {
    std::cout << "Possible memory leak!\n";
    rc = 1;
  }
  return( rc );
}
int main()
{
    copy_test();
    copy_backward_test();
    transform_test();
    replace_test();
    replace_if_test();
    replace_copy_test();
    replace_copy_if_test();
    fill_test();
    fill_n_test();
    generate_test();
    generate_n_test();
    remove_test();
    remove_if_test();
    remove_copy_test();
    remove_copy_if_test();
    unique_test();
    unique_copy_test();
    reverse_test();
    reverse_copy_test();
    boost::report_errors();
}
Example #10
0
/*
 * Main stuff of testing
 *
 * @param __self - task to be compiled
 * @param __cur_testing_dir - current testing directory
 * @param __points - collected points
 * @param __errors - solution's errors on tests
 * @oaram __params - collecting params to return to WebIFACE
 */
static void
testing_main_loop (wt_task_t *__self, const char *__cur_data_dir,
                   const char *__cur_testing_dir, int *__points,
                   char *__errors, assarr_t *__params)
{
  int i;

  INF_DEBUG_LOG ("Task %ld. Enter testing mainloop stuff\n", __self->sid);

  /* Bonus points (if all tests passed) */
  int bonus = atoi (TASK_INPUT_PARAM (*__self, "BONUS"));

  /* I/O filenames  */
  /* Name of input file */
  char *input_file = TASK_INPUT_PARAM (*__self, "INPUTFILE");
  /* Name of output file  */
  char *output_file = TASK_INPUT_PARAM (*__self, "OUTPUTFILE");

  /* Resource limits */
  /* But why simple atof doesn't work? */
  DWORD memory_limit = flexval_atolf (TASK_INPUT_PARAM (*__self,
                                               "MEMORYLIMIT")) * 1024; /* Kb */
  DWORD time_limit = flexval_atolf (TASK_INPUT_PARAM (*__self,
                                        "TIMELIMIT")) * USEC_COUNT; /* usecs */

  char full_input[4096],  /* Full input filename */
       full_output[4096], /* Full output filename */
       checker_cmd[4096]; /* Command to execute */

  /* String with all tests' results */
  char tests_res_pchar[(MAX_ERRCODE + 1) * MAX_TESTS];

  /* Process's descriptor */
  run_process_info_t *proc = NULL;

  /* Filename to execute */
  char execfn[4096] = {0};

  /* Errors */
  BOOL RE = FALSE, ML = FALSE, TL = FALSE, WA = FALSE, PE = FALSE, CR = FALSE;
  /* PChar-ed error for current test */
  char cur_err_str[MAX_ERRCODE + 1];
  BOOL acm = !strcmp (TASK_INPUT_PARAM (*__self, "ACM"), "TRUE");

  /* Unpack tests' data */
  char *tests_pchar = TASK_INPUT_PARAM (*__self, "TESTS"),
          effective_tests[4096];

  char **tests_pchar_arr = 0;

  /* Points for tests */
  int tests[MAX_TESTS];

  /* Dummy pchar value */
  char dummy[1024];

  int compiler_chroot = COMPILER_SAFE_INT_KEY (TASK_COMPILER_ID (*__self),
                                              "ChRoot", -1);

  /* Get command for solution executing */
  char *run_solution_cmd = COMPILER_SAFE_PCHAR_KEY (TASK_COMPILER_ID (*__self),
                                                    "RunSolutionCmd", NULL);

  if (run_solution_cmd && strcmp (run_solution_cmd, ""))
    {
      /* We'll make some changes in this string, so we should */
      /* close this string to make original stored in hive tree */
      /* for correct freeing */
      run_solution_cmd = strdup (run_solution_cmd);

      /* String may be enlarged when parameters will be substitued  */
      run_solution_cmd = realloc (run_solution_cmd, 65535);

      replace_defaults (run_solution_cmd, __cur_testing_dir, __cur_data_dir);
    }

  /*
   * TODO: Need to strip dupicated spaces in source string with tests
   */

  trim (tests_pchar, effective_tests);
  int tests_count = explode (effective_tests, " ", &tests_pchar_arr);

  /* Per-compiler resource usage correction */
  double time_corr, rss_corr;

  assarr_t *outputs = NULL, *checker_outputs = NULL;
  char *output = NULL;

  for (i = 0; i < tests_count; i++)
    {
      tests[i] = atoi (tests_pchar_arr[i]);
    }

  /* Free unwanted data */
  free_explode_data (tests_pchar_arr);

  /* Some more initializations */
  snprintf (full_input, BUF_SIZE (full_input), "%s/%s",
            __cur_testing_dir, input_file);
  snprintf (full_output, BUF_SIZE (full_output), "%s/%s",
            __cur_testing_dir, output_file);

  strcpy (tests_res_pchar, "");

  TASK_LOG (*__self, "----\n");

  /* Get executable file name */
  INF_PCHAR_KEY (execfn, "FileToExec");
  strcat (execfn, COMPILER_SAFE_PCHAR_KEY (TASK_COMPILER_ID (*__self),
                                           "OutputExtension", ""));
  if (run_solution_cmd)
    {
      REPLACE_VAR (run_solution_cmd, "executable", execfn);
    }
  else
    {
      run_solution_cmd = strdup (execfn);
    }

  if (compiler_chroot >= 0)
    {
      use_chroot = compiler_chroot;
    }

  /* Copying all libs/binaries needed for correct running of solution */
  if (use_chroot)
    {
      copy_chroot_data (__cur_testing_dir);
    }

  /* Get corrections to apply when executing solution */
  snprintf (dummy, BUF_SIZE (dummy), "ResourceCorrections/Compilers/%s/Time",
            TASK_COMPILER_ID (*__self));
  INF_SAFE_FLOAT_KEY (time_corr, dummy, 0);

  snprintf (dummy, BUF_SIZE (dummy), "ResourceCorrections/Compilers/%s/RSS",
            TASK_COMPILER_ID (*__self));
  INF_SAFE_FLOAT_KEY (rss_corr, dummy, 0);

  /* Apply corrections */
  time_limit += time_corr * USEC_COUNT;
  memory_limit += rss_corr;

  if (fabs (time_corr) > 1e-8 || fabs (rss_corr) > 1e-8)
    {
      INF_DEBUG_LOG ("Using per-compiler corrections: RSS: %lf, time: %lf\n",
                     rss_corr, time_corr);
    }

  if (need_store_output () && max_output_store_size > 0)
    {
      outputs = assarr_create ();
      output = malloc (max_output_store_size + 1);
    }

  if (need_store_checker_output ())
    {
      checker_outputs = assarr_create ();
    }

  /* Cycle by tests */
  INF_DEBUG_LOG ("Task %ld. Begin cycle by tests\n", __self->sid);
  for (i = 0; i < tests_count; i++)
    {
      LOOP_CHECK_ACTIVE;

      /* Some pre-initialization */
      strcpy (cur_err_str, "OK");

      /* Command to execute checker */
      build_checker_cmd (__self, __cur_testing_dir, __cur_data_dir,
                         i + 1, tests_count, checker_cmd);

      /* Copy test file (input file) */
      INF_DEBUG_LOG ("Task %ld. Copy test\n", __self->sid);
      if (!copy_test (i + 1, tests_count, __cur_data_dir,
                      __cur_testing_dir, input_file))
        {
          TASK_LOG (*__self, "\n--------\n"
                             "Fatal error: error copying test file #%d.\n"
                             "Testing aborted.\n", i + 1);
          REPORT (__params, "Error copying test #%d.", i + 1);
          LOOPCRASH;
        }

      /* Execute solution */
      SAFE_FREE_PROC (proc);
      INF_DEBUG_LOG ("Task %ld. Executing solution (cmd: %s)\n",
                     __self->sid, run_solution_cmd);
      proc = run_create_process (run_solution_cmd, __cur_testing_dir,
                                 memory_limit, time_limit);

      /* Set security info */
      run_set_usergroup (proc, solution_exec_uid, solution_exec_gid);
      run_set_chroot (proc, use_chroot);

      run_execute_process (proc);
      run_pwait (proc);
      INF_DEBUG_LOG ("Task %ld. Finish executing solution\n", __self->sid);

      LOOP_CHECK_ACTIVE;

      if (RUN_PROC_EXEC_ERROR (*proc))
        {
          INF_DEBUG_LOG ("Task %ld. "
                         "Fatal error duting executing solution: %s\n",
                         __self->sid, RUN_PROC_ERROR_DESC (*proc));

          TASK_LOG (*__self, "\n--------\n"
                             "Fatal error: error executing solution "
                             "at test #%d: %s.\nTesting aborted.\n",
                    i + 1, RUN_PROC_ERROR_DESC (*proc));

          REPORT (__params, "Error executing solution at test #%d: %s.",
                  i + 1, RUN_PROC_ERROR_DESC (*proc));

          LOOPCRASH;
        }

      INF_DEBUG_LOG ("Task %ld test #%d: solution exit with exit_code %d, "
                     "rss_usage %lld and time_usage %lld\n", __self->sid, i,
                     RUN_PROC_EXITCODE (*proc), RUN_PROC_RSSUSAGE (*proc),
                     RUN_PROC_TIMEUSAGE (*proc));

      if (RUN_PROC_PIPEBUF (*proc))
        {
          INF_DEBUG_LOG ("Pipe from task %ld test #%d: %s\n", __self->sid, i,
                         RUN_PROC_PIPEBUF (*proc));
        }

      /* Overview solution's status */
      if (RUN_PROC_MEMORYLIMIT (*proc))
        {
          ERR (ML, "ML")
        }
      else if (RUN_PROC_TIMELIMIT (*proc))
        {
          ERR (TL, "TL")
        }
      else if (PROCESS_RUNTIME_ERROR (*proc))
        {
          ERR (RE, "RE")
        }
      else
        {
          if (!fexists (full_output))
            {
              /* No output file. Presentation error. */
              INF_DEBUG_LOG ("Task %ld. Output file not found after "
                             "running solution.", __self->sid);

              ERR (PE, "PE");
            }
          else
            {
              /* Need this here because in case of ACM rules */
              /* macro ERR() may abort testing cycle */
              if (outputs)
                {
                  FILE *stream = fopen (full_output, "r");

                  snprintf (dummy, BUF_SIZE (dummy), "%d", i);

                  if (stream)
                    {
                      size_t len = fread (output, 1,
                                          max_output_store_size, stream);
                      output[len] = 0;

                      assarr_set_value (outputs, dummy, strdup (output));

                      fclose (stream);
                    }
                }

              /* Exec checker */
              SAFE_FREE_PROC (proc);
              INF_DEBUG_LOG ("Task %ld. Executing checker (cmd: %s)\n",
                             __self->sid, checker_cmd);
              proc = run_create_process (checker_cmd, __cur_data_dir,
                                         checker_memory_limit,
                                         checker_time_limit);

              run_execute_process (proc);
              run_pwait (proc);
              INF_DEBUG_LOG ("Task %ld. Finish executing checker\n",
                             __self->sid);

              LOOP_CHECK_ACTIVE;

              /* Error while trying to execute checker */
              if (RUN_PROC_EXEC_ERROR (*proc))
                {
                  INF_DEBUG_LOG ("Task %ld. "
                                 "Fatal error duting executing checker: %s\n",
                                 __self->sid, RUN_PROC_ERROR_DESC (*proc));

                  TASK_LOG (*__self, "\n--------\n"
                                     "Fatal error: error executing checker "
                                     "at test #%d: %s.\nTesting aborted.\n",
                            i + 1, RUN_PROC_ERROR_DESC (*proc));

                  REPORT (__params, "Error executing checker at test #%d: %s.",
                          i + 1, RUN_PROC_ERROR_DESC (*proc));

                  LOOPCRASH;
                }


              /* Checker finished by signal. */
              if (RUN_PROC_TERMINATED (*proc))
                {
                  TASK_LOG (*__self, "\n--------\n"
                                     "Fatal error: Abnormal checker "
                                     "termionation at test #%d. "
                                     "TERM signal: %d.\nTesting aborted.\n",
                            i + 1, RUN_PROC_TERMSIG (*proc));

                  REPORT (__params, "Abnormal checker termination at test #%d. "
                                    "TERM signal: %d.", i + 1,
                          RUN_PROC_TERMSIG (*proc));

                  LOOPCRASH;
                }

              INF_DEBUG_LOG ("Task %ld. "
                             "Checker finished working with exit code %d\n",
                             __self->sid, RUN_PROC_EXITCODE (*proc));

              /* Resource usage error while executing checker */
              if (RUN_PROC_MEMORYLIMIT (*proc) || RUN_PROC_TIMELIMIT (*proc))
                {
                  INF_DEBUG_LOG ("Task %ld. "
                                 "Checker's resource usage error (%s)\n",
                                 __self->sid, ((RUN_PROC_MEMORYLIMIT (*proc)) ?
                                                   ("Memory limit") :
                                                   ("Time limit")));

#ifdef __DEBUG
                  if (RUN_PROC_MEMORYLIMIT (*proc))
                    {
                      INF_DEBUG_LOG ("Task %ld. Checker's memory limit was"
                                     " %lld but %lld was used\n",
                                     __self->sid, checker_memory_limit,
                                     RUN_PROC_RSSUSAGE (*proc));
                    }
                  else
                    {
                      INF_DEBUG_LOG ("Task %ld. Checker's time limit was %lld "
                                     "but %lld was used\n", __self->sid,
                                     checker_time_limit,
                                     RUN_PROC_TIMEUSAGE (*proc));
                    }
#endif

                  TASK_LOG (*__self, "\n--------\n"
                                     "Fatal error: resource limit error while "
                                     "executing checker.\nTesting aborted.\n");
                  REPORT (__params, "Resource limit exceeded while executing "
                                    "checker at test #%d. ",
                          i + 1);

                  LOOPCRASH;
                }

              /* Store checker's output message */
              if (checker_outputs && RUN_PROC_PIPEBUF (*proc))
                {
                  snprintf (dummy, BUF_SIZE (dummy), "%d", i);

                  assarr_set_value (checker_outputs, dummy,
                                    strdup (RUN_PROC_PIPEBUF (*proc)));
                }

              /* Overview checker's exit code */
              switch (RUN_PROC_EXITCODE (*proc))
                {
                case _OK:
                  /* Update points for task */
                  (*__points) += tests[i];
                  push_string ("OK", " ", tests_res_pchar);
                  break;
                case _WA:
                  ERR (WA, "WA");
                  break;
                case _PE:
                  ERR (PE, "PE");
                  break;
                default:
                  /* Unknown checker's exit code */
                  TASK_LOG (*__self, "\n--------\nFatal error: checker exited "
                                     "with unknown code: %d.\nBuffer from "
                                     "checker: %s\nTesting aborted.\n",
                            RUN_PROC_EXITCODE (*proc),
                            RUN_PROC_PIPEBUF (*proc));

                  REPORT (__params, "Checker exited with unknown code: %d\n"
                                    "Buffer from checker: %s",
                          i + 1, RUN_PROC_PIPEBUF (*proc));

                  LOOPCRASH;
                  break;
                }

              SAFE_FREE_PROC (proc);
            }
        }

      /* Delete input file (to reduce storaging of garbage) and */
      /* correct handling of PE */
      unlink (full_input);
      unlink (full_output);

      SAFE_FREE_PROC (proc);

      /* Log information about passed test */
      LOG_TEST;
    }

  INF_DEBUG_LOG ("Task %ld. Testing mainloop finished\n", __self->sid);

__done_:
  SAFE_FREE_PROC (proc);

  SAFE_FREE (run_solution_cmd);

  assarr_set_value (__params, "TESTS", strdup (tests_res_pchar));

  if (use_chroot)
    {
      remove_chroot_data (__cur_testing_dir);
    }

  LOOP_DONE_CHECK_ACTIVE;

  if (!CR)
    {
      if (RE) push_string ("RE", " ", __errors);
      if (ML) push_string ("ML", " ", __errors);
      if (TL) push_string ("TL", " ", __errors);
      if (WA) push_string ("WA", " ", __errors);
      if (PE) push_string ("PE", " ", __errors);

      /* If errors' string is empty, no errors were occured */
      /* in task's testing. So we can set bonus to points. */
      if (!strcmp (__errors, ""))
        {
          (*__points) += bonus;
          strcpy (__errors, "OK");
        }
    }

  STORE_OUTPUTS (outputs,         "SOLUTION_OUTPUT");
  STORE_OUTPUTS (checker_outputs, "CHECKER_OUTPUT");

  SAFE_FREE (output);
}
Example #11
0
int main()
{
    copy_test();
    return boost::report_errors();
}
Example #12
0
void instantiation_record::print_for_wme_trace(bool isChunk, bool printFooter)
{
    Output_Manager* outputManager = thisAgent->outputManager;

    if (conditions->empty())
    {
        outputManager->printa(thisAgent, "No conditions on left-hand-side\n");
    }
    else
    {
        condition_record* lCond;
        bool lInNegativeConditions = false;
        int lConditionCount = 0;
        action* rhs;
        test id_test_without_goal_test = NULL;

        outputManager->set_column_indent(0, 7);
        outputManager->set_column_indent(1, 57);
        outputManager->set_column_indent(2, 72);
        /* Print header */
        outputManager->printa_sf(thisAgent, "Working memory trace of instantiation # %u %-(match of rule %y at level %d)\n",
            instantiationID, production_name, static_cast<int64_t>(match_level));
        outputManager->printa_sf(thisAgent, "%- %-Operational %-Creator\n\n");
        outputManager->set_print_test_format(false, true);

        for (condition_record_list::iterator it = conditions->begin(); it != conditions->end(); it++)
        {
            lCond = (*it);
            ++lConditionCount;
            if (lInNegativeConditions)
            {
                if (lCond->type != CONJUNCTIVE_NEGATION_CONDITION)
                {
                    outputManager->printa(thisAgent, "     }\n");
                    lInNegativeConditions = false;
                }
            } else {
                if (lCond->type == CONJUNCTIVE_NEGATION_CONDITION)
                {
                    outputManager->printa(thisAgent, "     -{\n");
                    lInNegativeConditions = true;
                }
            }
            outputManager->printa_sf(thisAgent, "%d:%-", lConditionCount);

            id_test_without_goal_test = copy_test(thisAgent, lCond->condition_tests.id, false, false, true);

            outputManager->printa_sf(thisAgent, "(%t%s^%t %t%s)%-",
                id_test_without_goal_test, ((lCond->type == NEGATIVE_CONDITION) ? " -" : " "),
                lCond->condition_tests.attr, lCond->condition_tests.value,
                lCond->test_for_acceptable_preference ? " +" : "");
            deallocate_test(thisAgent, id_test_without_goal_test);

            bool isSuper = (match_level > 0) && (lCond->wme_level_at_firing < match_level);
            outputManager->printa_sf(thisAgent, "%s", (isSuper ? "    Yes" : "    No"));
            if (lCond->parent_instantiation)
            {
                outputManager->printa_sf(thisAgent, "%-i %u (%y)%-",
                    (lCond->parent_instantiation->instantiationID),
                    (lCond->parent_instantiation->production_name));
            } else if (lCond->type == POSITIVE_CONDITION)
            {
                outputManager->printa_sf(thisAgent, isSuper ? "%-Higher-level Problem Space%-" : "%-Soar Architecture%-");
            } else {
                outputManager->printa_sf(thisAgent, "%-N/A%-");
            }
            outputManager->printa(thisAgent, "\n");
        }
        if (lInNegativeConditions)
        {
            outputManager->printa(thisAgent, "     }\n");
        }
        outputManager->printa(thisAgent, "   -->\n");
        thisAgent->explanationMemory->print_instantiation_actions(actions, thisAgent->explanationMemory->get_production(original_productionID), rhs);
        if (printFooter) {
            thisAgent->explanationMemory->print_footer();
        }
    }
}