Esempio n. 1
0
int main()
{
  test_basic();
  test_capacity();
  test_comparison();
  test_composite_key();
  test_conv_iterators();
  test_copy_assignment();
  test_hash_ops();
  test_iterators();
  test_key_extractors();
  test_list_ops();
  test_modifiers();
  test_mpl_ops();
  test_observers();
  test_projection();
  test_range();
  test_rank_ops();
  test_rearrange();
  test_safe_mode();
  test_serialization();
  test_set_ops();
  test_special_set_ops();
  test_update();

  return boost::report_errors();
}
int test_main(int,char *[])
{
    test_comparison();
    return 0;
}
int main()
{
  test_comparison();
  return boost::report_errors();
}
Esempio n. 4
0
int main (int   argc,
          char *argv[])
{
  gfloat reference    [NUM_PIXELS * 4];
  gfloat test_alpha   [NUM_PIXELS * 4];
  gfloat test_rgba_r  [NUM_PIXELS * 4];
  gfloat test_rgba_g  [NUM_PIXELS * 4];
  gfloat test_rgba_b  [NUM_PIXELS * 4];
  gfloat test_ok      [NUM_PIXELS * 4];
  gint   result;
  gint   i;

  gegl_init (&argc, &argv);

  /* Init an arbitrary image */
  for (i = 0; i < NUM_PIXELS; i++)
    {
      gfloat coef = i / (gfloat) (i + 1.0);
      reference [i * 4 + 0] = CLAMP (coef,             0.0, 1.0);
      reference [i * 4 + 1] = CLAMP (1.0 - coef,       0.0, 1.0);
      reference [i * 4 + 2] = CLAMP (SQR (1.0 - coef), 0.0, 1.0);
      reference [i * 4 + 3] = CLAMP (SQR (coef),       0.0, 1.0);
    }

  memcpy (test_alpha,  reference, NUM_PIXELS * 4 * sizeof (gfloat));
  memcpy (test_rgba_r, reference, NUM_PIXELS * 4 * sizeof (gfloat));
  memcpy (test_rgba_g, reference, NUM_PIXELS * 4 * sizeof (gfloat));
  memcpy (test_rgba_b, reference, NUM_PIXELS * 4 * sizeof (gfloat));
  memcpy (test_ok   ,  reference, NUM_PIXELS * 4 * sizeof (gfloat));

  /* Images are 8x16 RGBA, alters some pixels.
   * Try to trick image-compare's implementation
   * by setting the lowest difference first
   */
  test_rgba_r [4 * (2 * NUM_COLS + 9)  + 0] -= -0.01;
  test_rgba_r [4 * (7 * NUM_COLS + 14) + 0] = 0.1;

  test_rgba_g [4 * (1 * NUM_COLS + 9) + 1] += 0.01;
  test_rgba_g [4 * (2 * NUM_COLS + 4) + 1] = 0.1;

  test_rgba_b [4 * (4 * NUM_COLS + 0) + 2] += 0.01;
  test_rgba_b [4 * (5 * NUM_COLS + 3) + 2] = 0.3;

  test_alpha [4 * (3 * NUM_COLS + 6)  + 3] -= 0.01;
  test_alpha [4 * (7 * NUM_COLS + 12) + 3] = 0.1;

  /* Perform all 5 tests cases */
  result  = SUCCESS;

  if (test_comparison (reference, test_alpha, &alpha_case))
    {
      g_printerr ("-> Comparison failed for the alpha channel case\n");
      result = FAILURE;
    }
  if (test_comparison (reference, test_rgba_r, &rgba_r_case))
    {
      g_printerr ("-> Comparison failed for the red channel case\n");
      result = FAILURE;
    }
  if (test_comparison (reference, test_rgba_g, &rgba_g_case))
    {
      g_printerr ("-> Comparison failed for the green channel case\n");
      result = FAILURE;
    }
  if (test_comparison (reference, test_rgba_b, &rgba_b_case))
    {
      g_printerr ("-> Comparison failed for the blue channel case\n");
      result = FAILURE;
    }
  if (test_comparison (reference, test_ok, &ok_case))
    {
      g_printerr ("-> Comparison failed for the reference case\n");
      result = FAILURE;
    }

  gegl_exit ();

  return result;
}