int main() { MBED_HOSTTEST_TIMEOUT(15); MBED_HOSTTEST_SELECT(default_auto); MBED_HOSTTEST_DESCRIPTION(Interrupt vector relocation); MBED_HOSTTEST_START("MBED_A18"); // First test, no table reallocation { printf("Starting first test (interrupts not relocated).\r\n"); bool ret = test_once(); if (ret == false) { MBED_HOSTTEST_RESULT(false); } } // Relocate interrupt table and test again { printf("Starting second test (interrupts relocated).\r\n"); memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table)); SCB->VTOR = (uint32_t)int_table; bool ret = test_once(); if (ret == false) { MBED_HOSTTEST_RESULT(false); } } MBED_HOSTTEST_RESULT(true); }
/** * General test case * test_x is where the images are located * test_y is the output * test_size is how many images will be tested */ void ConvNet::test(vec2d_t test_x, vec_host test_y, size_t test_size, bool save_layer) { // assert(batch_size > 0); // assert(test_size % batch_size == 0); test_x_ = test_x; test_y_ = test_y; test_size_ = test_size; size_t iter = 0; int bang = 0; srand(663); #ifdef GPU std::cout << "Testing with GPU " << std::endl; #else std::cout << "Testing with CPU " << std::endl; #endif // GPU this->mark.start(); this->layers_output.resize(layers.size()); while (iter < test_size_) { int result = 0; result = test_once(iter) ? 1 : 0; bang += result; if (save_layer) { save_gold_layers(this->layers_output, iter); } iter++; } this->mark.stop(); std::cout << "bang/test_size_: " << (float) bang / test_size_ << std::endl; std::cout << "Time spent testing " << this->test_size_ << " samples: " << this->mark << std::endl; }
int main(int argc, char **argv) { if (!test_once() || !test_thread_local()) { return 1; } printf("PASS\n"); return 0; }
static void test_many_times (Fixture *f, gconstpointer context) { guint i, n_repeats; if (g_test_slow ()) n_repeats = N_REPEATS_SLOW; else n_repeats = N_REPEATS; for (i = 0; i < n_repeats; i++) test_once (f, context); }
bool test_n(shenidam_t processor, float* base,size_t total_num_samples,double sample_rate,size_t num_samples_track, double sigma,int num_tries) { int num_succeeded = 0; int num_failed = 0; if (!quiet) { printf("Testing with Sigma = %g\n",sigma); } for(int i = 0; i < num_tries; i++) { if (!test_once(processor,base,total_num_samples,sample_rate,num_samples_track,sigma)) { if (verbose) { printf("Match Failed!\n"); } num_failed++; } else { if (verbose) { printf("Match Succeeded!\n"); } num_succeeded++; } if (num_failed > num_tries/2) { return false; } else if (num_succeeded > num_tries/2) { return true; } } return true; }
bool ConvNet::test_once_random() { int test_x_index = uniform_rand(0, test_size_ - 1); return test_once(test_x_index); }