static gboolean run_timer (gpointer data) { SourceInfo *info = data; if (is_greater_than (&last_runtime, &info->intended_runtime)) { g_error ("out-of-order timer execution: expected to be run at %u.%03ums, " "it already got event intended for time %u.%03ums", ((guint) info->intended_runtime.tv_sec - init_second) * 1000 + (guint) info->intended_runtime.tv_usec / 1000, (guint) info->intended_runtime.tv_usec % 1000, ((guint) last_runtime.tv_sec - init_second) * 1000 + (guint) last_runtime.tv_usec / 1000, (guint) last_runtime.tv_usec % 1000); } last_runtime = info->intended_runtime; if (info->period == -1 || rand() < RAND_MAX / 100 * PERCENT_ODDS_OF_STOPPING) { info->period = -1; return FALSE; } if (rand() < RAND_MAX / 10) { info->period = rand () / (RAND_MAX / MAX_RANDOM_PERIOD); gsk_source_adjust_timer (info->source, info->period, info->period); info->intended_runtime = gsk_main_loop_default()->current_time; } add_ms (&info->intended_runtime, info->period); return TRUE; }
Ensure(FFT, creates_output_vector_of_correct_size) { Vec x, y, z; PetscInt inputDim = 10; PetscInt inputBlockSize = 3; DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE,inputDim,inputBlockSize,1,NULL,&da); scFftCreate(da, &fft); scFftCreateVecsFFTW(fft, &x, &y, &z); PetscInt dim = 10; VecGetSize(x, &dim); assert_that(dim, is_greater_than(inputDim)); VecDestroy(&x); VecDestroy(&y); VecDestroy(&z); scFftDestroy(&fft); }