Esempio n. 1
0
CU_TEST_END


static void event_decoder_suite_setup(void)
{
    nrf_cunit_mock_call * p_mock_obj;

    reset_test();
    nrf_cunit_reset_mock();
    // Verify the SWI2_IRQ is not set.
    CU_ASSERT(NVIC_GetPendingIRQ(SWI2_IRQn) == 0);

    nrf_cunit_expect_call_return((uint8_t *)"hci_transport_rx_pkt_consume", &p_mock_obj);
    p_mock_obj->compare_rule[0] = COMPARE_ANY;
}
Esempio n. 2
0
void SortingTester::test_all(int size, int num_tests, bool partial_sort){
    std::cout << "Initializing contents.\n" << std::endl;
    initialize_contents(size);

    if (!data_){
        std::cout << "ERROR: Data uninitialized." << std::endl;
        std::cout << "Stopping tests." << std::endl;
        return;
    }

    std::cout << "Beginning Tests." << std::endl;
    for (auto& sort : sorters_){
        // Test each sort
        cur_sort = sort->name();

        std::cout << "Testing " << cur_sort << std::endl;

        SortingTestSummary summary(cur_sort);

        for (int i = 0; i < num_tests; i++){
            shuffle_contents();
            start_timer();
            sort->operator()(data_, size);
            int time_ms = stop_timer();

            if (!check_sorted()){
                std::cout << "ERROR: TEST FAILED!" << std::endl;
            }

            summary.add_result(size, time_ms, comparisons, swap_count);
            reset_test();
        }

        summaries_.push_back(summary);
    }
}
Esempio n. 3
0
int main (int argc, char **argv)
{
  // setup pointers to drawstuff callback functions
  dsFunctions fn;
  fn.version = DS_VERSION;
  fn.start = &start;
  fn.step = &simLoop;
  fn.command = 0;
  fn.stop = 0;
  fn.path_to_textures = "../../drawstuff/textures";
  if(argc==2)
    {
        fn.path_to_textures = argv[1];
    }

  dRandSetSeed (time(0));
  reset_test();

  // run simulation
  dsSimulationLoop (argc,argv,352,288,&fn);

  dWorldDestroy (world);
  return 0;
}
Esempio n. 4
0
static void simLoop (int pause)
{
  if (!pause) {
    dBodyAddTorque (anchor_body,torque[0],torque[1],torque[2]);
    dBodyAddTorque (test_body,torque[0],torque[1],torque[2]);
    dWorldStep (world,0.03);

    iteration++;
    if (iteration >= 100) {
      // measure the difference between the anchor and test bodies
      const dReal *w1 = dBodyGetAngularVel (anchor_body);
      const dReal *w2 = dBodyGetAngularVel (test_body);
      const dReal *q1 = dBodyGetQuaternion (anchor_body);
      const dReal *q2 = dBodyGetQuaternion (test_body);
      dReal maxdiff = dMaxDifference (w1,w2,1,3);
      printf ("w-error = %.4e  (%.2f,%.2f,%.2f) and (%.2f,%.2f,%.2f)\n",
	      maxdiff,w1[0],w1[1],w1[2],w2[0],w2[1],w2[2]);
      maxdiff = dMaxDifference (q1,q2,1,4);
      printf ("q-error = %.4e\n",maxdiff);
      reset_test();
    }
  }

  dReal sides[3] = {SIDE,SIDE,SIDE};
  dReal sides2[3] = {6*SIDE,6*SIDE,6*SIDE};
  dReal sides3[3] = {3*SIDE,3*SIDE,3*SIDE};
  dsSetColor (1,1,1);
  dsDrawBox (dBodyGetPosition(anchor_body), dBodyGetRotation(anchor_body),
	     sides3);
  dsSetColor (1,0,0);
  dsDrawBox (dBodyGetPosition(test_body), dBodyGetRotation(test_body), sides2);
  dsSetColor (1,1,0);
  for (int i=0; i<NUM; i++)
    dsDrawBox (dBodyGetPosition (particle[i]),
	       dBodyGetRotation (particle[i]), sides);
}