int main() { int i; test_results(1, build_initial_cmd(), NULL, NULL, 1); /* syntax check */ test_results(2, build_initial_cmd(), check_for_initial_fact, NULL, 1); test_results(3, build_initial_cmd(), check_for_extra_fact, NULL, 1); for (i = 0; i < NUM_TESTS; i++) test(i); printf("==============================================================\n"); printf("Score: %2d / 90\n", total_score); return 0; }
static GLboolean draw_and_test(int x_offset, int y_offset, float min_lod, float max_lod) { GLfloat y; int dim; int level; GLboolean pass = GL_TRUE; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, max_lod); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, min_lod); y = y_offset; for (level = 0, dim = MAX_SIZE; dim > 0; level++, dim /= 2) { piglit_draw_rect_tex(x_offset, y, dim, dim, 0.0, 0.0, 1.0, 1.0); y += dim + PAD; } y = y_offset; for (level = 0, dim = MAX_SIZE; dim > 0; level++, dim /= 2) { pass = pass && test_results(x_offset, y, dim, level, min_lod, max_lod) && pass; y += dim + PAD; } return pass; }
void test(int ix) { struct world_list *wl = NULL, *tmp; struct test test = all_tests[ix]; char *cmd; int i; wl = calloc(1, sizeof(*wl)); wl->world = read_test_file(test.filenames[0]); for (i = 1; test.filenames[i]; i++) { tmp = calloc(1, sizeof(*tmp)); tmp->world = read_test_file(test.filenames[i]); tmp->next = wl; wl = tmp; } cmd = build_test_cmd(wl); test_results(4 + ix, cmd, test_everything, wl, test.score); /* syntax check */ while (wl) { tmp = wl->next; free_world(wl->world); free(wl); wl = tmp; } }
static int run_network_tests(void) { struct network_test *t = _state.s_network_tests.nt_next; while (t) { if (t->nt_state != TEST_STATE_DONE) { run_network_test(t); return 1; } t = t->nt_next; } t = _state.s_network_tests.nt_next; if (t) { test_results(); while (t) { struct network_test *next = t->nt_next; free(t); t = next; } _state.s_network_tests.nt_next = NULL; } return 0; }
int main (void) { struct array arr = {{{1,2}, {3,4}}, 1}; struct pair last = arr.elems[arr.index]; test_results ( last.x, last.y, arr.elems[1].x, arr.elems[1].y); return 0; }
int main(int argc, char **argv) { int i; if (argc > 1 && sscanf(argv[1], "%d", &i) && i > 0 && i < NUM_TESTS + 4) { switch (i) { case 1: test_results(1, build_initial_cmd(), NULL, NULL, 1); break; case 2: test_results(2, build_initial_cmd(), check_for_initial_fact, NULL, 1); break; case 3: test_results(3, build_initial_cmd(), check_for_extra_fact, NULL, 1); break; default: test(i - 4); } return 0; } else if (argc > 1) { fprintf(stderr, "Garbage on command line args, ignoring..\n"); } test_results(1, build_initial_cmd(), NULL, NULL, 1); /* syntax check */ test_results(2, build_initial_cmd(), check_for_initial_fact, NULL, 1); test_results(3, build_initial_cmd(), check_for_extra_fact, NULL, 1); for (i = 0; i < NUM_TESTS; i++) test(i); printf("==============================================================\n"); printf("Score: %2d / 90\n", total_score); return 0; }
int main(int argc, char ** argv) { long order; /* order of a the matrix */ int Tile_order=32; /* default tile size for tiling of local transpose */ int iterations; /* number of times to do the transpose */ int tiling; /* boolean: true if tiling is used */ int i, j, it, jt, iter; /* dummies */ double bytes; /* combined size of matrices */ double * RESTRICT A; /* buffer to hold original matrix */ double * RESTRICT B; /* buffer to hold transposed matrix */ double abserr; /* absolute error */ double epsilon=1.e-8; /* error tolerance */ double transpose_time,/* timing parameters */ avgtime; int nthread_input, nthread; int num_error=0; /* flag that signals that requested and obtained numbers of threads are the same */ /********************************************************************* ** read and test input parameters *********************************************************************/ printf("Parallel Research Kernels version %s\n", PRKVERSION); printf("OpenMP Matrix transpose: B = A^T\n"); if (argc != 4 && argc != 5){ printf("Usage: %s <# threads> <# iterations> <matrix order> [tile size]\n", *argv); exit(EXIT_FAILURE); } /* Take number of threads to request from command line */ nthread_input = atoi(*++argv); if ((nthread_input < 1) || (nthread_input > MAX_THREADS)) { printf("ERROR: Invalid number of threads: %d\n", nthread_input); exit(EXIT_FAILURE); } omp_set_num_threads(nthread_input); iterations = atoi(*++argv); if (iterations < 1){ printf("ERROR: iterations must be >= 1 : %d \n",iterations); exit(EXIT_FAILURE); } order = atoi(*++argv); if (order < 0){ printf("ERROR: Matrix Order must be greater than 0 : %d \n", order); exit(EXIT_FAILURE); } if (argc == 5) Tile_order = atoi(*++argv); /* a non-positive tile size means no tiling of the local transpose */ tiling = (Tile_order > 0) && (Tile_order < order); if (!tiling) Tile_order = order; /********************************************************************* ** Allocate space for the input and transpose matrix *********************************************************************/ A = (double *)malloc(order*order*sizeof(double)); if (A == NULL){ printf(" ERROR: cannot allocate space for input matrix: %ld\n", order*order*sizeof(double)); exit(EXIT_FAILURE); } B = (double *)malloc(order*order*sizeof(double)); if (B == NULL){ printf(" ERROR: cannot allocate space for output matrix: %ld\n", order*order*sizeof(double)); exit(EXIT_FAILURE); } bytes = 2.0 * sizeof(double) * order * order; #pragma omp parallel private (iter) { #pragma omp master { nthread = omp_get_num_threads(); if (nthread != nthread_input) { num_error = 1; printf("ERROR: number of requested threads %d does not equal ", nthread_input); printf("number of spawned threads %d\n", nthread); } else { printf("Number of threads = %i;\n",nthread_input); printf("Matrix order = %ld\n", order); printf("Number of iterations = %d\n", iterations); if (tiling) { printf("Tile size = %d\n", Tile_order); #ifdef COLLAPSE printf("Using loop collapse\n"); #endif } else printf("Untiled\n"); } } bail_out(num_error); /* Fill the original matrix, set transpose to known garbage value. */ if (tiling) { #ifdef COLLAPSE #pragma omp for private (i,it,jt) collapse(2) #else #pragma omp for private (i,it,jt) #endif for (j=0; j<order; j+=Tile_order) for (i=0; i<order; i+=Tile_order) for (jt=j; jt<MIN(order,j+Tile_order);jt++) for (it=i; it<MIN(order,i+Tile_order); it++){ A(it,jt) = (double) (order*jt + it); B(it,jt) = 0.0; } } else { #pragma omp for private (i) for (j=0;j<order;j++) for (i=0;i<order; i++) { A(i,j) = (double) (order*j + i); B(i,j) = 0.0; } } for (iter = 0; iter<=iterations; iter++){ /* start timer after a warmup iteration */ if (iter == 1) { #pragma omp barrier #pragma omp master { transpose_time = wtime(); } } /* Transpose the matrix */ if (!tiling) { #pragma omp for private (j) for (i=0;i<order; i++) for (j=0;j<order;j++) { B(j,i) += A(i,j); A(i,j) += 1.0; } } else { #ifdef COLLAPSE #pragma omp for private (j,it,jt) collapse(2) #else #pragma omp for private (j,it,jt) #endif for (i=0; i<order; i+=Tile_order) for (j=0; j<order; j+=Tile_order) for (it=i; it<MIN(order,i+Tile_order); it++) for (jt=j; jt<MIN(order,j+Tile_order);jt++) { B(jt,it) += A(it,jt); A(it,jt) += 1.0; } } } /* end of iter loop */ #pragma omp barrier #pragma omp master { transpose_time = wtime() - transpose_time; } } /* end of OpenMP parallel region */ abserr = test_results (order, B, iterations); /********************************************************************* ** Analyze and output results. *********************************************************************/ if (abserr < epsilon) { printf("Solution validates\n"); avgtime = transpose_time/iterations; printf("Rate (MB/s): %lf Avg time (s): %lf\n", 1.0E-06 * bytes/avgtime, avgtime); #ifdef VERBOSE printf("Squared errors: %f \n", abserr); #endif exit(EXIT_SUCCESS); } else { printf("ERROR: Aggregate squared error %lf exceeds threshold %e\n", abserr, epsilon); exit(EXIT_FAILURE); } } /* end of main */
static GLboolean draw_at_size(int size, int x_offset, int y_offset, GLboolean mipmapped) { GLfloat row_y = PAD + y_offset; int dim, face; int color = 0, level = 0, maxlevel, baselevel = 3; GLuint texname; GLboolean pass = GL_TRUE; GLint loc; glUseProgram(program_cube); loc = glGetUniformLocation(program_cube, "tex"); glUniform1i(loc, 0); /* texture unit p */ /* Create the texture. */ glGenTextures(1, &texname); glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texname); /* For each face drawing, we want to only see that face's contents at * that mipmap level. */ if (mipmapped) { glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); } else { glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); /* Fill in faces on each level */ for (dim = size; dim > 0; dim /= 2) { if (test_state != STATE_PLAIN_SHADER) color = (level) % ARRAY_SIZE(colors); for (face = 0; face < 6; face++) { set_face_image(level, cube_face_targets[face], dim, color); if (test_state == STATE_PLAIN_SHADER) color = (color + 1) % ARRAY_SIZE(colors); } if (!mipmapped) break; level++; } maxlevel = level; if (maxlevel >= ARRAY_SIZE(colors)) maxlevel = ARRAY_SIZE(colors) - 1; glEnable(GL_TEXTURE_CUBE_MAP_ARB); color = 0; level = 0; if (test_state == STATE_LOD_BIAS_SHADER) level = baselevel; for (dim = size; dim > 0; dim /= 2) { GLfloat row_x = PAD + x_offset; if (test_state == STATE_LOD_SHADER) level = baselevel; for (face = 0; face < 6; face++) { GLfloat base_x = row_x + face * (max_size + PAD); GLfloat base_y = row_y; if (test_state != STATE_PLAIN_SHADER) { color = level; if (color >= ARRAY_SIZE(colors)) color = ARRAY_SIZE(colors) - 1; } glBegin(GL_QUADS); glTexCoord3fv(cube_face_texcoords[face][0]); glVertex2f(base_x, base_y); glTexCoord3fv(cube_face_texcoords[face][1]); glVertex2f(base_x + dim, base_y); glTexCoord3fv(cube_face_texcoords[face][2]); glVertex2f(base_x + dim, base_y + dim); glTexCoord3fv(cube_face_texcoords[face][3]); glVertex2f(base_x, base_y + dim); glEnd(); if (dim > 2) { pass = test_results(base_x, base_y, dim, level, face, mipmapped, color, maxlevel) && pass; } if (test_state == STATE_PLAIN_SHADER) color = (color + 1) % ARRAY_SIZE(colors); } if (!mipmapped) break; row_y += dim + PAD; level++; if (test_state != STATE_PLAIN_SHADER) if (level > maxlevel) level = maxlevel; } glUseProgram(0); glDeleteTextures(1, &texname); return pass; }
static GLboolean draw_at_size(int size, int x_offset, int y_offset, GLboolean mipmapped) { GLfloat row_y = PAD + y_offset; int dim, face; int color = 0, level = 0; GLuint texname; GLboolean pass = GL_TRUE; /* Create the texture. */ glGenTextures(1, &texname); glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, texname); /* For each face drawing, we want to only see that face's contents at * that mipmap level. */ if (mipmapped) { glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); } else { glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); /* Fill in faces on each level */ for (dim = size; dim > 0; dim /= 2) { for (face = 0; face < 6; face++) { set_face_image(level, cube_face_targets[face], dim, color); color = (color + 1) % ARRAY_SIZE(colors); } if (!mipmapped) break; level++; } glEnable(GL_TEXTURE_CUBE_MAP_ARB); color = 0; level = 0; for (dim = size; dim > 0; dim /= 2) { GLfloat row_x = PAD + x_offset; for (face = 0; face < 6; face++) { GLfloat base_x = row_x + face * (max_size + PAD); GLfloat base_y = row_y; glBegin(GL_QUADS); glTexCoord3fv(cube_face_texcoords[face][0]); glVertex2f(base_x, base_y); glTexCoord3fv(cube_face_texcoords[face][1]); glVertex2f(base_x + dim, base_y); glTexCoord3fv(cube_face_texcoords[face][2]); glVertex2f(base_x + dim, base_y + dim); glTexCoord3fv(cube_face_texcoords[face][3]); glVertex2f(base_x, base_y + dim); glEnd(); if (dim > 2) { pass = test_results(base_x, base_y, dim, level, face, mipmapped, color) && pass; } color = (color + 1) % ARRAY_SIZE(colors); } if (!mipmapped) break; row_y += dim + PAD; level++; } glDeleteTextures(1, &texname); return pass; }
int main(int argc, char ** argv) { int order; /* order of a the matrix */ int tile_size=32; /* default tile size for tiling of local transpose */ int iterations; /* number of times to do the transpose */ int i, j, it, jt, iter; /* dummies */ double bytes; /* combined size of matrices */ double * RESTRICT A; /* buffer to hold original matrix */ double * RESTRICT B; /* buffer to hold transposed matrix */ double errsq; /* squared error */ double epsilon=1.e-8; /* error tolerance */ double trans_time, /* timing parameters */ avgtime = 0.0, maxtime = 0.0, mintime = 366.0*24.0*3600.0; /* set the minimum time to a large value; one leap year should be enough */ int nthread_input, nthread; int num_error=0; /* flag that signals that requested and obtained numbers of threads are the same */ /********************************************************************* ** read and test input parameters *********************************************************************/ if (argc != 4 && argc != 5){ printf("Usage: %s <# threads> <# iterations> <matrix order> [tile size]\n", *argv); exit(EXIT_FAILURE); } /* Take number of threads to request from command line */ nthread_input = atoi(*++argv); if ((nthread_input < 1) || (nthread_input > MAX_THREADS)) { printf("ERROR: Invalid number of threads: %d\n", nthread_input); exit(EXIT_FAILURE); } omp_set_num_threads(nthread_input); iterations = atoi(*++argv); if (iterations < 1){ printf("ERROR: iterations must be >= 1 : %d \n",iterations); exit(EXIT_FAILURE); } order = atoi(*++argv); if (order < 0){ printf("ERROR: Matrix Order must be greater than 0 : %d \n", order); exit(EXIT_FAILURE); } if (argc == 5) tile_size = atoi(*++argv); /* a non-positive tile size means no tiling of the local transpose */ if (tile_size <=0) tile_size = order; /********************************************************************* ** Allocate space for the input and transpose matrix *********************************************************************/ A = (double *)malloc(order*order*sizeof(double)); if (A == NULL){ printf(" Error allocating space for input matrix\n"); exit(EXIT_FAILURE); } B = (double *)malloc(order*order*sizeof(double)); if (B == NULL){ printf(" Error allocating space for transposed matrix\n"); exit(EXIT_FAILURE); } bytes = 2.0 * sizeof(double) * order * order; #pragma omp parallel private (iter) { #pragma omp master { nthread = omp_get_num_threads(); printf("OpenMP Matrix transpose: B = A^T\n"); if (nthread != nthread_input) { num_error = 1; printf("ERROR: number of requested threads %d does not equal ", nthread_input); printf("number of spawned threads %d\n", nthread); } else { printf("Number of threads = %i;\n",nthread_input); printf("Matrix order = %d\n", order); if (tile_size < order) printf("Tile size = %d\n", tile_size); else printf("Untiled\n"); printf("Number of iterations = %d\n", iterations); } } bail_out(num_error); /* Fill the original matrix, set transpose to known garbage value. */ #pragma omp for private (j) for (i=0;i<order; i++) { for (j=0;j<order;j++) { *(A+i*order+j) = COL_SHIFT * j + ROW_SHIFT * i; *(B+i*order+j) = -1.0; } } errsq = 0.0; for (iter = 0; iter<iterations; iter++){ #pragma omp barrier #pragma omp master { trans_time = wtime(); } /* Transpose the matrix; only use tiling if the tile size is smaller than the matrix */ if (tile_size < order) { #pragma omp for private (j, it, jt) for (i=0; i<order; i+=tile_size) { for (j=0; j<order; j+=tile_size) { for (it=i; it<MIN(order,i+tile_size); it++){ for (jt=j; jt<MIN(order,j+tile_size);jt++){ B[it+order*jt] = A[jt+order*it]; } } } } } else { #pragma omp for private (j) for (i=0;i<order; i++) { for (j=0;j<order;j++) { B[i+order*j] = A[j+order*i]; } } } #pragma omp master { trans_time = wtime() - trans_time; #ifdef VERBOSE printf("\nFinished with transpose, using %lf seconds \n", trans_time); #endif if (iter>0 || iterations==1) { /* skip the first iteration */ avgtime = avgtime + trans_time; mintime = MIN(mintime, trans_time); maxtime = MAX(maxtime, trans_time); } } errsq += test_results (order, B); } /* end of iter loop */ } /* end of OpenMP parallel region */ /********************************************************************* ** Analyze and output results. *********************************************************************/ if (errsq < epsilon) { printf("Solution validates\n"); avgtime = avgtime/(double)(MAX(iterations-1,1)); printf("Rate (MB/s): %lf, Avg time (s): %lf, Min time (s): %lf", 1.0E-06 * bytes/mintime, avgtime, mintime); printf(", Max time (s): %lf\n", maxtime); #ifdef VERBOSE printf("Squared errors: %f \n", errsq); #endif exit(EXIT_SUCCESS); } else { printf("ERROR: Aggregate squared error %lf exceeds threshold %e\n", errsq, epsilon); exit(EXIT_FAILURE); } } /* end of main */
void TestTysonNovakCellCycleModel() throw(Exception) { // Set up SimulationTime* p_simulation_time = SimulationTime::Instance(); unsigned num_timesteps = 50; p_simulation_time->SetEndTimeAndNumberOfTimeSteps(3.0, num_timesteps); double standard_divide_time = 75.19/60.0; // Test TysonNovakCellCycleModel methods for a healthy cell TysonNovakCellCycleModel* p_cell_model = new TysonNovakCellCycleModel; p_cell_model->SetBirthTime(p_simulation_time->GetTime()); TS_ASSERT_EQUALS(p_cell_model->CanCellTerminallyDifferentiate(), false); MAKE_PTR(WildTypeCellMutationState, p_healthy_state); MAKE_PTR(StemCellProliferativeType, p_stem_type); CellPtr p_cell(new Cell(p_healthy_state, p_cell_model)); p_cell->SetCellProliferativeType(p_stem_type); p_cell->InitialiseCellCycleModel(); p_cell_model->SetDt(0.1/60.0); /* * For coverage, we create another cell-cycle model that is identical except that we * manually pass in an ODE solver. In this case, our ODE solver (BackwardEulerIvpOdeSolver) * is the same type as the solver used by the cell-cycle model if no solver is provided * (unless CVODE is used), so our results should be identical. */ boost::shared_ptr<CellCycleModelOdeSolver<TysonNovakCellCycleModel, BackwardEulerIvpOdeSolver> > p_solver(CellCycleModelOdeSolver<TysonNovakCellCycleModel, BackwardEulerIvpOdeSolver>::Instance()); p_solver->SetSizeOfOdeSystem(6); p_solver->Initialise(); TysonNovakCellCycleModel* p_other_cell_model = new TysonNovakCellCycleModel(p_solver); p_other_cell_model->SetBirthTime(p_simulation_time->GetTime()); // Timestep for non-adaptive solvers defaults to 0.0001 TS_ASSERT_EQUALS(p_other_cell_model->GetDt(), 0.0001); p_other_cell_model->SetDt(0.1/60.0); CellPtr p_other_cell(new Cell(p_healthy_state, p_other_cell_model)); p_other_cell->SetCellProliferativeType(p_stem_type); p_other_cell->InitialiseCellCycleModel(); // Test the cell is ready to divide at the right time for (unsigned i=0; i<num_timesteps/2; i++) { p_simulation_time->IncrementTimeOneStep(); double time = p_simulation_time->GetTime(); bool result = p_cell_model->ReadyToDivide(); bool other_result = p_other_cell_model->ReadyToDivide(); if (time > standard_divide_time) { TS_ASSERT_EQUALS(result, true); TS_ASSERT_EQUALS(other_result, true); } else { TS_ASSERT_EQUALS(result, false); TS_ASSERT_EQUALS(other_result, false); } } // Test ODE solution std::vector<double> proteins = p_cell_model->GetProteinConcentrations(); TS_ASSERT_EQUALS(proteins.size(), 6u); TS_ASSERT_DELTA(proteins[0], 0.10000000000000, 1e-2); TS_ASSERT_DELTA(proteins[1], 0.98913684535843, 1e-2); TS_ASSERT_DELTA(proteins[2], 1.54216806705641, 1e-1); TS_ASSERT_DELTA(proteins[3], 1.40562614481544, 2e-2); TS_ASSERT_DELTA(proteins[4], 0.67083371879876, 1e-2); TS_ASSERT_DELTA(proteins[5], 0.95328206604519, 2e-2); std::vector<double> other_proteins = p_other_cell_model->GetProteinConcentrations(); TS_ASSERT_EQUALS(other_proteins.size(), 6u); TS_ASSERT_DELTA(other_proteins[0], 0.10000000000000, 1e-2); TS_ASSERT_DELTA(other_proteins[1], 0.98913684535843, 1e-2); TS_ASSERT_DELTA(other_proteins[2], 1.54216806705641, 1e-1); TS_ASSERT_DELTA(other_proteins[3], 1.40562614481544, 2e-2); TS_ASSERT_DELTA(other_proteins[4], 0.67083371879876, 1e-2); TS_ASSERT_DELTA(other_proteins[5], 0.95328206604519, 2e-2); TS_ASSERT_EQUALS(p_cell_model->ReadyToDivide(),true); // For coverage, we also test TysonNovakCellCycleModel methods for a mutant cell p_cell_model->ResetForDivision(); TS_ASSERT_EQUALS(p_cell_model->ReadyToDivide(),false); TysonNovakCellCycleModel* p_cell_model2 = static_cast<TysonNovakCellCycleModel*> (p_cell_model->CreateCellCycleModel()); MAKE_PTR(ApcOneHitCellMutationState, p_mutation); CellPtr p_stem_cell_2(new Cell(p_mutation, p_cell_model2)); TS_ASSERT_EQUALS(p_cell_model2->ReadyToDivide(),false); p_stem_cell_2->SetCellProliferativeType(p_stem_type); TS_ASSERT_EQUALS(p_cell_model->ReadyToDivide(),false); TS_ASSERT_EQUALS(p_cell_model2->ReadyToDivide(),false); // Test the cell is ready to divide at the right time for (unsigned i=0; i<num_timesteps/2; i++) { p_simulation_time->IncrementTimeOneStep(); double time = p_simulation_time->GetTime(); bool result = p_cell_model->ReadyToDivide(); bool result2 = p_cell_model2->ReadyToDivide(); if (time > 2.0* standard_divide_time) { TS_ASSERT_EQUALS(result, true); TS_ASSERT_EQUALS(result2, true); } else { TS_ASSERT_EQUALS(result, false); TS_ASSERT_EQUALS(result2, false); } } // Test ODE solution proteins = p_cell_model->GetProteinConcentrations(); TS_ASSERT_EQUALS(proteins.size(), 6u); TS_ASSERT_DELTA(proteins[0], 0.10000000000000, 1e-2); TS_ASSERT_DELTA(proteins[1], 0.98913684535843, 1e-2); TS_ASSERT_DELTA(proteins[2], 1.54216806705641, 1e-1); TS_ASSERT_DELTA(proteins[3], 1.40562614481544, 1e-1); TS_ASSERT_DELTA(proteins[4], 0.67083371879876, 1e-2); TS_ASSERT_DELTA(proteins[5], 0.9662, 1e-2); // Coverage of AbstractOdeBasedCellCycleModel::SetProteinConcentrationsForTestsOnly() std::vector<double> test_results(6); for (unsigned i=0; i<6; i++) { test_results[i] = (double)i; } p_cell_model->SetProteinConcentrationsForTestsOnly(1.0, test_results); proteins = p_cell_model->GetProteinConcentrations(); for (unsigned i=0; i<6; i++) { TS_ASSERT_DELTA(proteins[i], test_results[i], 1e-6); } }