From c0424e3129cb2308470b24eea8bf6f9993296d28 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 23 Mar 2016 15:44:39 +0000
Subject: [PATCH] Don't forget to initialise the time in the engine

---
 tests/testPair.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tests/testPair.c b/tests/testPair.c
index bbd719ab74..f2f8bc8300 100644
--- a/tests/testPair.c
+++ b/tests/testPair.c
@@ -54,6 +54,9 @@ struct cell *make_cell(size_t n, double *offset, double h,
   cell->loc[1] = offset[1];
   cell->loc[2] = offset[2];
 
+  cell->ti_end_min = 1;
+  cell->ti_end_max = 1;
+
   cell->sorted = 0;
   cell->sort = NULL;
   cell->sortsize = 0;
@@ -159,6 +162,14 @@ int main(int argc, char *argv[]) {
   }
 
   space.periodic = 0;
+  space.h_max = h;
+  space.dt_step = 0.1;
+
+  engine.s = &space;
+  engine.time = 0.1f;
+  engine.ti_current = 1;
+  runner.e = &engine;
+
   volume = particles * particles * particles;
   message("particles: %zu B\npositions: 0 B", 2 * volume * sizeof(struct part));
 
@@ -166,15 +177,6 @@ int main(int argc, char *argv[]) {
   for (size_t i = 0; i < type + 1; ++i) offset[i] = particles;
   cj = make_cell(particles, offset, h, &partId);
 
-  for (int i = 0; i < 3; ++i) {
-    space.h_max = h;
-    space.dt_step = 0.1;
-  }
-
-  engine.s = &space;
-  engine.time = 0.1f;
-  runner.e = &engine;
-
   time = 0;
   for (size_t i = 0; i < runs; ++i) {
 
@@ -205,7 +207,7 @@ int main(int argc, char *argv[]) {
 
   tic = getticks();
 
-  /* Run the test */
+  /* Run the brute-force test */
   pairs_all_density(&runner, ci, cj);
 
   toc = getticks();
-- 
GitLab