Exemplo n.º 1
0
// Tests that the different score comparison functions give the expected
// results on the given score values.
static void test_score_compare(score_category_t cat_a, uint32_t sub_a,
    unsigned rel, score_category_t cat_b, uint32_t sub_b) {
  // Run the values through the new score test for good measure.
  value_t a = test_new_score(cat_a, sub_a);
  value_t b = test_new_score(cat_b, sub_b);
  ASSERT_TRUE(test_relation(value_ordering_compare(a, b), rel));
  int compared = compare_tagged_scores(a, b);
  ASSERT_TRUE(test_relation(integer_to_relation(compared), rel));
}
Exemplo n.º 2
0
// Given two scores returns the best of them.
static value_t best_score(value_t a, value_t b) {
  return (compare_tagged_scores(a, b) > 0) ? a : b;
}