static void
ability_scores_alloc_method_1_test(void)
{
    struct rnd *rnd = rnd_alloc_fake_ascending(0);
    struct ability_scores *scores = ability_scores_alloc_method_1(rnd);

    assert(15 == scores->values[0]);
    assert(15 == scores->values[1]);
    assert(13 == scores->values[2]);
    assert(13 == scores->values[3]);
    assert( 9 == scores->values[4]);
    assert( 9 == scores->values[5]);

    ability_scores_free(scores);
    rnd_free(rnd);
}
Exemplo n.º 2
0
static void
dice_roll_and_drop_lowest_test(void)
{
    struct rnd *ascending = rnd_alloc_fake_ascending(0);
    struct rnd *always_one = rnd_alloc_fake_fixed(0);
    struct rnd *always_two = rnd_alloc_fake_fixed(1);
    int score;
    
    score = dice_roll_and_drop_lowest(dice_make(4, 6), ascending);
    assert(9 == score);
    
    score = dice_roll_and_drop_lowest(dice_make(3, 6), always_one);
    assert(2 == score);
    
    score = dice_roll_and_drop_lowest(dice_make(5, 4), always_two);
    assert(8 == score);
    
    rnd_free(ascending);
    rnd_free(always_one);
    rnd_free(always_two);
}
Exemplo n.º 3
0
static void
dice_roll_with_average_scoring_test(void)
{
    struct rnd *ascending = rnd_alloc_fake_ascending(0);
    struct rnd *always_one = rnd_alloc_fake_fixed(0);
    struct rnd *always_two = rnd_alloc_fake_fixed(1);
    int score;
    
    score = dice_roll_with_average_scoring(dice_make(3, 6), ascending);
    assert(8 == score);
    
    score = dice_roll_with_average_scoring(dice_make(3, 6), always_one);
    assert(9 == score);
    
    score = dice_roll_with_average_scoring(dice_make(3, 6), always_two);
    assert(6 == score);
    
    rnd_free(ascending);
    rnd_free(always_one);
    rnd_free(always_two);
}