void create(const string str_tmpl_file = "") { // if we are trying to create a single reference file, overwrite the global // test list if ( str_tmpl_file.length() ) { tests_c.clear(); tests_c.push_back( test_s(str_tmpl_file) ); } cout << "\nCreating " << tests_c.size() << " reference tests...\n" << endl; for (unsigned int n=0; n < tests_c.size(); n++) { test_s & r_test = tests_c[n]; templ.Set_Template_File( r_test.str_file ); const string str_out_file = get_reference_file( r_test.str_file ); ofstream out_stream; out_stream.open(str_out_file.c_str(), std::ios::out); const string str_reference_output = templ.Process(); out_stream.write(str_reference_output.c_str(), str_reference_output.length()); out_stream.close(); cout << r_test.str_file << endl; } }
void spatial_test() { enum { MIN_OBJS = 150, MAX_OBJS = 170, }; glDisable(GL_TEXTURE_2D); for(int i=objs.size()-1; i>=0; i--) { test_t* obj = objs[i]; glColor3ub(0xff,0,0); if(obj->is_visible()) { if(!world()->is_visible(*obj)) std::cerr << *obj << " thinks it is visible but it isn't" << std::endl; else if(!obj->drawn) std::cerr << *obj << " thinks it is visible but wasn't drawn" << std::endl; else glColor3ub(0,0xff,0); } else { if(world()->is_visible(*obj)) std::cerr << *obj << " thinks it is invisible but it is" << std::endl; else if(obj->drawn) std::cerr << *obj << " is invisible but was drawn" << std::endl; else glColor3ub(0,0,0xff); } obj->drawn = false; caret(obj->get_pos(),obj->SZ,obj->rx,obj->ry,obj->rz); if(!obj->tick()) { objs.erase(objs.begin()+i); delete obj; } } glEnable(GL_TEXTURE_2D); if(!objs.size() < MIN_OBJS) { const size_t n = MIN_OBJS+(rand()%(MAX_OBJS-MIN_OBJS)); while(objs.size()<n) { objs.push_back(new test_t()); } } }