summaryrefslogtreecommitdiff
path: root/tests/calculate_score.cpp
blob: 3555f0171ea02ce2516e4479517343ee98274d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#define BOOST_TEST_MODULE calculate_score
#include <boost/test/unit_test.hpp>

#include <boost/assign/list_of.hpp>
using boost::assign::list_of;

#include "../src/player.h"

BOOST_AUTO_TEST_CASE(tsumo_tanyao) {
	Player player;
	player.client = make_shared<ClientDumb>();
	player.round_start(0);
	
	player.hand = list_of
		(Tile::Man_2)(Tile::Man_2)(Tile::Man_2)
		(Tile::Pin_2)(Tile::Pin_3)(Tile::Pin_4)
		(Tile::Sou_2)(Tile::Sou_2)(Tile::Sou_2)
		(Tile::Man_8)(Tile::Man_8);
	
	player.declare_tsumo();
	
	BOOST_CHECK_EQUAL(player.won, true);
	BOOST_CHECK_EQUAL(player.won_value.yaku, 2);
	BOOST_CHECK_EQUAL(player.won_value.fu, 32);
	BOOST_CHECK_EQUAL(player.won_value.tsumo(), 700);
	BOOST_CHECK_EQUAL(player.won_value.tsumo_east(), 1300);
}

BOOST_AUTO_TEST_CASE(ron_tanyao) {
	Player player;
	player.client = make_shared<ClientDumb>();
	player.round_start(0);
	
	player.hand = list_of
		(Tile::Man_2)(Tile::Man_2)(Tile::Man_2)
		(Tile::Pin_2)(Tile::Pin_3)(Tile::Pin_4)
		(Tile::Sou_2)(Tile::Sou_2)(Tile::Sou_2)
		(Tile::Man_8);
	
	player.declare_ron(Tile::Man_8);
	
	BOOST_CHECK_EQUAL(player.won, true);
	BOOST_CHECK_EQUAL(player.won_value.yaku, 1);
	BOOST_CHECK_EQUAL(player.won_value.fu, 40);
	BOOST_CHECK_EQUAL(player.won_value.ron(), 1300);
	BOOST_CHECK_EQUAL(player.won_value.ron_east(), 2000);
}