Beispiel #1
0
void
test_at(void)
{
  uint16_t element_size;
  for (element_size = 1; element_size < 16; element_size++) {
    test_basic_operations(element_size, 0);
  }
}
Beispiel #2
0
void
test_use_malloc(void)
{
  uint16_t element_size;
  for (element_size = 1; element_size < 16; element_size++) {
    test_basic_operations(element_size, GRN_TINY_ARRAY_USE_MALLOC);
  }
}
Beispiel #3
0
void
test_threadsafe(void)
{
  /* TODO: A multi-threaded test should be done. */

  uint16_t element_size;
  for (element_size = 1; element_size < 16; element_size++) {
    test_basic_operations(element_size, GRN_TINY_ARRAY_THREADSAFE);
  }
}
Beispiel #4
0
int main() {
  test_basic_operations();

  test_set_and_get_for_all_data_types();
  test_contains_and_find_one_for_all_data_types();

  test_internal_type_conversion();
  test_contains();
  test_find_one();

  return 0;
}
Beispiel #5
0
int main(int argc, char *argv[])
{
    printf("** Basic operations **\n");
    test_basic_operations();
    printf("Verified OK!\n\n");

    printf("** Stress test **\n");
    stress_test();
    printf("Verified OK!\n\n");

    return 0;
}
Beispiel #6
0
void
test_clear(void)
{
  grn_id id;
  grn_tiny_array array;
  grn_tiny_array_init(&ctx, &array, sizeof(int), GRN_TINY_ARRAY_CLEAR);
  for (id = 1; id < (1 << 10); id++) {
    const int expected_value = 0;
    const int * const value_ptr = (const int *)grn_tiny_array_at(&array, id);
    cut_assert_not_null(value_ptr);
    cut_assert_equal_memory(&expected_value, sizeof(expected_value),
                            value_ptr, sizeof(int));
  }
  grn_tiny_array_fin(&array);

  {
    uint16_t element_size;
    for (element_size = 1; element_size < 16; element_size++) {
      test_basic_operations(element_size, GRN_TINY_ARRAY_CLEAR);
    }
  }
}
Beispiel #7
0
/*
This program tests the IOQueue.
*/
int main(int argc, const char* argv[])
{
	test_basic_operations();
	test_thread_safety();
	return EXIT_SUCCESS;
}
Beispiel #8
0
void test_basic_operations() {
  test_basic_operations(grnxx::Bool(true));
  test_basic_operations(grnxx::Int(123));
  test_basic_operations(grnxx::Float(1.25));
  test_basic_operations(grnxx::GeoPoint(grnxx::Int(123), grnxx::Int(456)));
  test_basic_operations(
      grnxx::GeoPoint(grnxx::Float(35.681382), grnxx::Float(-139.766084)));
  test_basic_operations(grnxx::Text("ABC"));

  grnxx::Bool bool_values[] = {
    grnxx::Bool(true),
    grnxx::Bool(false),
    grnxx::Bool(true)
  };
  grnxx::BoolVector bool_vector(bool_values, 3);
  test_basic_operations(bool_vector);

  grnxx::Int int_values[] = {
    grnxx::Int(123),
    grnxx::Int(-456),
    grnxx::Int(789)
  };
  grnxx::IntVector int_vector(int_values, 3);
  test_basic_operations(int_vector);

  grnxx::Float float_values[] = {
    grnxx::Float(1.23),
    grnxx::Float(-4.56),
    grnxx::Float(7.89)
  };
  grnxx::FloatVector float_vector(float_values, 3);
  test_basic_operations(float_vector);

  grnxx::GeoPoint geo_point_values[] = {
    { grnxx::Float(43.068661), grnxx::Float(141.350755) },  // Sapporo.
    { grnxx::Float(35.681382), grnxx::Float(139.766084) },  // Tokyo.
    { grnxx::Float(34.702485), grnxx::Float(135.495951) },  // Osaka.
  };
  grnxx::GeoPointVector geo_point_vector(geo_point_values, 3);
  test_basic_operations(geo_point_vector);

  grnxx::Text text_values[] = {
    grnxx::Text("abc"),
    grnxx::Text("DEF"),
    grnxx::Text("ghi")
  };
  grnxx::TextVector text_vector(text_values, 3);
  test_basic_operations(text_vector);
}