示例#1
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_set_n_too_high_3) {
  dp_context_t* ctx = dp_create();
  ck_assert(dp_set_epsilon(ctx, 2872) == 1);
  dp_destroy(ctx);
} END_TEST
示例#2
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_set_n_too_low_2) {
  dp_context_t* ctx = dp_create();
  ck_assert(dp_set_epsilon(ctx, -100000) == -1);
  dp_destroy(ctx);
} END_TEST
示例#3
0
void dp_baselist_destroy_elems(dp_baselist_t *bl) {
 uint32_t i;
 if (bl && bl->valid) {
  for (i=0;i<bl->count;i++) {
   dp_destroy(bl->list[i]);
  }
 }
}
示例#4
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_set_n_epsilon_3) {
  dp_context_t* ctx = dp_create();
  dp_set_n(ctx, 9);
  dp_set_epsilon(ctx, 0.8);

  ck_assert(9 == ctx->n);
  ck_assert(0.8 == ctx->epsilon);
  ck_assert(GEOM_EQ(1.5518455739153598, ctx->step));

  dp_destroy(ctx);
} END_TEST
示例#5
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_set_n_epsilon_2) {
  dp_context_t* ctx = dp_create();
  dp_set_n(ctx, 1279);
  dp_set_epsilon(ctx, 0.2);

  ck_assert(1279 == ctx->n);
  ck_assert(0.2 == ctx->epsilon);
  ck_assert(GEOM_EQ(305.8415144851744, ctx->step));

  dp_destroy(ctx);
} END_TEST
示例#6
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_set_n_epsilon_1) {
  dp_context_t* ctx = dp_create();
  dp_set_n(ctx, 32);
  dp_set_epsilon(ctx, 0.5);

  ck_assert(32 == ctx->n);
  ck_assert(0.5 == ctx->epsilon);
  ck_assert(GEOM_EQ(5.656854249492381, ctx->step));

  dp_destroy(ctx);
} END_TEST
示例#7
0
文件: dollarp.c 项目: jamoozy/libsr
} END_TEST

START_TEST(c_dp_add_many_large_templates) {
  dp_context_t* ctx = dp_create();

  // add several templates for a rectangle.
  const int num = 4;
  const char* fnames[] = {
    "data/rect1.stroke.srz",
    "data/rect2.stroke.srz",
    "data/rect3.stroke.srz",
    "data/rect4.stroke.srz"
  };
  for (int i = 0; i < num; i++) {
    if (_add_to_template(ctx, fnames[i], "rectangle")) {
      dp_destroy(ctx);
      ck_abort_msg("Could not load stroke.");
    }
  }

  debug("Destroying context: %p\n", ctx);
  dp_destroy(ctx);
} END_TEST