summaryrefslogtreecommitdiff
path: root/tests/OsikaEvaluatorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/OsikaEvaluatorTest.php')
-rw-r--r--tests/OsikaEvaluatorTest.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/OsikaEvaluatorTest.php b/tests/OsikaEvaluatorTest.php
index e69de29..1256515 100644
--- a/tests/OsikaEvaluatorTest.php
+++ b/tests/OsikaEvaluatorTest.php
@@ -0,0 +1,42 @@
+<?php
+
+class OsikaEvaluatorTest extends PHPUnit_Framework_TestCase {
+
+ private $_evaluator;
+
+ public function setUp() {
+ require_once('../bin/lib/OsikaEvaluator.php');
+ $this->_evaluator = new OsikaEvaluator();
+ }
+
+ public function handProvider() {
+ $file = file('OsikaEvaluatorTest.tests');
+ $ret = [];
+ $switch = false;
+ $item;
+ foreach ($file as $line) {
+ if (trim($line)) {
+ if ($switch) {
+ $item[] = json_decode($line);
+ $ret[] = $item;
+ }
+ else {
+ $item = [trim($line)];
+ }
+ $switch = !$switch;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * @dataProvider handProvider
+ **/
+ public function testEvaluation($hand, $result) {
+ $this->_evaluator->setHand($hand);
+ $this->assertEquals($result, $this->_evaluator->evaluate());
+ }
+
+}
+
+?>