summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/OsikaEvaluatorTest.php42
-rw-r--r--tests/OsikaEvaluatorTest.tests80
2 files changed, 122 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());
+ }
+
+}
+
+?>
diff --git a/tests/OsikaEvaluatorTest.tests b/tests/OsikaEvaluatorTest.tests
new file mode 100644
index 0000000..3bc7852
--- /dev/null
+++ b/tests/OsikaEvaluatorTest.tests
@@ -0,0 +1,80 @@
+xx|KDWx|AKxx|xxx
+{"lu":{"total":0.875,"s":0,"h":0.4375,"d":0.4375,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0,"h":1.25,"d":1.9375,"c":0,"total":3.1875},"lh_plus":{"s":0,"h":0.75,"d":0.5,"c":0,"total":1.25},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":-0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0,"h":2.4375,"d":2.875,"c":0,"total":5.3125},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.5}}
+
+xx|KDxx|KWxx|KWx
+{"lu":{"total":0.875,"s":0,"h":0.4375,"d":0.4375,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0,"h":1.25,"d":0.8125,"c":0.8125,"total":2.875},"lh_plus":{"s":0,"h":0.5,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":-0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0,"h":2.1875,"d":1.75,"c":1.3125,"total":5.25},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.1875}}
+
+xxxx|KDx|KWx|KWx
+{"lu":{"total":0.4375,"s":0.4375,"h":0,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0,"h":1.25,"d":0.8125,"c":0.8125,"total":2.875},"lh_plus":{"s":0,"h":0.5,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":-0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.4375,"h":1.75,"d":1.3125,"c":1.3125,"total":4.8125},"total":{"s":0,"h":0,"d":0,"c":0,"total":4.5}}
+
+ADWxx|x|Kxxx|xxx
+{"lu":{"total":1.9375,"s":1.5,"h":0,"d":0.4375,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":1.5625,"h":0,"d":0.8125,"c":0,"total":2.375},"lh_plus":{"s":0.75,"h":0,"d":0,"c":0,"total":0.75},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":-0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0.25},"short_suit":{"total":0.0625},"major_suit":{"total":0},"subtotal":{"s":3.8125,"h":0,"d":1.25,"c":0,"total":5.0625},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.3125}}
+
+5432|KQx|KJx|KJx
+{"lu":{"total":0.4375,"s":0.4375,"h":0,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0,"h":1.25,"d":0.8125,"c":0.8125,"total":2.875},"lh_plus":{"s":0,"h":0.5,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":-0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.4375,"h":1.75,"d":1.3125,"c":1.3125,"total":4.8125},"total":{"s":0,"h":0,"d":0,"c":0,"total":4.5}}
+
+Axx|xx|Axx|AKQxx
+{"lu":{"total":1.5,"s":0,"h":0,"d":0,"c":1.5},"lu_plus":{"total":-0.0625},"lh":{"s":1.125,"h":0,"d":1.125,"c":2.375,"total":4.625},"lh_plus":{"s":0,"h":0,"d":0,"c":0.75,"total":0.75},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":-0,"d":0,"c":0,"total":0},"lsz":{"total":0.125},"l10n":{"total":0.125},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":1.125,"h":0,"d":1.125,"c":4.625,"total":6.875},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.0625}}
+
+ADx|Dxxx|ADx|ADx
+{"lu":{"total":0.4375,"s":0,"h":0.4375,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":1.5625,"h":0.4375,"d":1.5625,"c":1.5625,"total":5.125},"lh_plus":{"s":0.5,"h":0,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":-0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":2.0625,"h":0.875,"d":2.0625,"c":2.0625,"total":7.0625},"total":{"s":0,"h":0,"d":0,"c":0,"total":6.75}}
+
+AWx|Dxxx|AWx|ADx
+{"lu":{"total":0.4375,"s":0,"h":0.4375,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":1.125,"h":0.4375,"d":1.125,"c":1.5625,"total":4.25},"lh_plus":{"s":0.5,"h":0,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":-0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":1.625,"h":0.875,"d":1.625,"c":2.0625,"total":6.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.875}}
+
+xx|AKxxx|Dxx|Kxx
+{"lu":{"total":1.5,"s":0,"h":1.5,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0,"h":1.9375,"d":0.4375,"c":0.8125,"total":3.1875},"lh_plus":{"s":0,"h":0.5,"d":0,"c":0,"total":0.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":-0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0.0625},"l10n":{"total":0.125},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0,"h":3.9375,"d":0.4375,"c":0.8125,"total":5.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.3125}}
+
+2|ADT98|W62|DW109
+{"lu":{"total":1.9375,"s":0,"h":1.5,"d":0,"c":0.4375},"lu_plus":{"total":0.0625},"lh":{"s":0,"h":1.5625,"d":0.125,"c":0.4375,"total":2.125},"lh_plus":{"s":0,"h":0.5,"d":0,"c":0.5,"total":1},"lh_10":{"s":0,"h":0.1875,"d":0,"c":0.1875,"total":0.375},"lh_short":{"s":-0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":-0.0625},"l10n":{"total":0.125},"short_suit":{"total":0.0625},"major_suit":{"total":0},"subtotal":{"s":0,"h":3.75,"d":0.125,"c":1.5625,"total":5.4375},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.625}}
+
+DJ42|J953|9|ADJ2
+{"lu":{"total":1.3125,"s":0.4375,"h":0.4375,"d":0,"c":0.4375},"lu_plus":{"total":0},"lh":{"s":0.4375,"h":0.125,"d":0,"c":1.5625,"total":2.125},"lh_plus":{"s":0.5,"h":0,"d":0,"c":0.75,"total":1.25},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":-0,"c":0,"total":0},"lsz":{"total":-0.125},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0.0625},"subtotal":{"s":1.375,"h":0.5625,"d":0,"c":2.75,"total":4.6875},"total":{"s":0,"h":0,"d":0,"c":0,"total":4.625}}
+
+K10764||J965|KD95
+{"lu":{"total":2.375,"s":1.5,"h":0,"d":0.4375,"c":0.4375},"lu_plus":{"total":0.0625},"lh":{"s":0.8125,"h":0,"d":0.125,"c":1.25,"total":2.1875},"lh_plus":{"s":0,"h":0,"d":0,"c":0.5,"total":0.5},"lh_10":{"s":0.125,"h":0,"d":0,"c":0,"total":0.125},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":2.4375,"h":0,"d":0.5625,"c":2.1875,"total":5.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.25}}
+
+QJ7|A1072|J97|A92
+{"lu":{"total":0.4375,"s":0,"h":0.4375,"d":0,"c":0},"lu_plus":{"total":0.0625},"lh":{"s":0.4375,"h":1.125,"d":0.125,"c":1.125,"total":2.8125},"lh_plus":{"s":0.5,"h":0,"d":0,"c":0,"total":0.5},"lh_10":{"s":0,"h":0.125,"d":0,"c":0,"total":0.125},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.9375,"h":1.6875,"d":0.125,"c":1.125,"total":3.875},"total":{"s":0,"h":0,"d":0,"c":0,"total":3.9375}}
+
+KQJ743|AKQ7||A96
+{"lu":{"total":3.1875,"s":2.75,"h":0.4375,"d":0,"c":0},"lu_plus":{"total":0},"lh":{"s":1.25,"h":2.375,"d":0,"c":1.125,"total":4.75},"lh_plus":{"s":0.75,"h":0.75,"d":0,"c":0,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":-0.125},"short_suit":{"total":0.0625},"major_suit":{"total":0.0625},"subtotal":{"s":4.75,"h":3.5625,"d":0,"c":1.125,"total":9.4375},"total":{"s":0,"h":0,"d":0,"c":0,"total":9.4375}}
+
+AKDJxx|10x|xxx|Kx
+{"lu":{"total":2.75,"s":2.75,"h":0,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":2.375,"h":0,"d":0,"c":0.8125,"total":3.1875},"lh_plus":{"s":0.75,"h":0,"d":0,"c":0,"total":0.75},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":-0,"d":0,"c":-0.0625,"total":-0.0625},"lsz":{"total":0},"l10n":{"total":0.25},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":5.875,"h":0,"d":0,"c":0.75,"total":6.625},"total":{"s":0,"h":0,"d":0,"c":0,"total":6.8125}}
+
+DW10x|A|AW10x|KW10x
+{"lu":{"total":1.3125,"s":0.4375,"h":0,"d":0.4375,"c":0.4375},"lu_plus":{"total":0.0625},"lh":{"s":0.4375,"h":1.125,"d":1.125,"c":0.8125,"total":3.5},"lh_plus":{"s":0.5,"h":0,"d":0.5,"c":0.5,"total":1.5},"lh_10":{"s":0.125,"h":0,"d":0.125,"c":0.125,"total":0.375},"lh_short":{"s":0,"h":-0.125,"d":0,"c":0,"total":-0.125},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":1.5,"h":1,"d":2.1875,"c":1.875,"total":6.5625},"total":{"s":0,"h":0,"d":0,"c":0,"total":6.625}}
+
+AKJ1092|865|J7|AJ
+{"lu":{"total":2.75,"s":2.75,"h":0,"d":0,"c":0},"lu_plus":{"total":0.0625},"lh":{"s":1.9375,"h":0,"d":0.125,"c":1.125,"total":3.1875},"lh_plus":{"s":0.75,"h":0,"d":0,"c":0.5,"total":1.25},"lh_10":{"s":0.1875,"h":0,"d":0,"c":0,"total":0.1875},"lh_short":{"s":0,"h":0,"d":-0.0625,"c":-0.125,"total":-0.1875},"lsz":{"total":0},"l10n":{"total":0.125},"short_suit":{"total":0},"major_suit":{"total":0.0625},"subtotal":{"s":5.625,"h":0,"d":0.0625,"c":1.5,"total":7.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.4375}}
+
+Q65|Q43|Q8653|Q6
+{"lu":{"total":1.5,"s":0,"h":0,"d":1.5,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0.4375,"h":0.4375,"d":0.4375,"c":0.4375,"total":1.75},"lh_plus":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":-0.0625,"total":-0.0625},"lsz":{"total":-0.125},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.4375,"h":0.4375,"d":1.9375,"c":0.375,"total":3.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":3}}
+
+A73|A103|AK94|AK10
+{"lu":{"total":0.4375,"s":0,"h":0,"d":0.4375,"c":0},"lu_plus":{"total":0.0625},"lh":{"s":1.125,"h":1.125,"d":1.9375,"c":1.9375,"total":6.125},"lh_plus":{"s":0,"h":0,"d":0.5,"c":0.5,"total":1},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0.125},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":1.125,"h":1.125,"d":2.875,"c":2.4375,"total":7.5625},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.75}}
+
+Kx|xx|x|AQT9xxxx
+{"lu":{"total":5,"s":0,"h":0,"d":0,"c":5},"lu_plus":{"total":0.0625},"lh":{"s":0.8125,"h":0,"d":0,"c":1.5625,"total":2.375},"lh_plus":{"s":0,"h":0,"d":0,"c":0.5,"total":0.5},"lh_10":{"s":0,"h":0,"d":0,"c":0.1875,"total":0.1875},"lh_short":{"s":-0.0625,"h":-0,"d":-0,"c":0,"total":-0.0625},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.75,"h":0,"d":0,"c":7.25,"total":8},"total":{"s":0,"h":0,"d":0,"c":0,"total":8.0625}}
+
+Qx|xx|x|KQT9xxxx
+{"lu":{"total":5,"s":0,"h":0,"d":0,"c":5},"lu_plus":{"total":0.0625},"lh":{"s":0.4375,"h":0,"d":0,"c":1.25,"total":1.6875},"lh_plus":{"s":0,"h":0,"d":0,"c":0.5,"total":0.5},"lh_10":{"s":0,"h":0,"d":0,"c":0.1875,"total":0.1875},"lh_short":{"s":-0.0625,"h":-0,"d":-0,"c":0,"total":-0.0625},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.375,"h":0,"d":0,"c":6.9375,"total":7.3125},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.375}}
+
+K72|KJ53|A42|AK7
+{"lu":{"total":0.4375,"s":0,"h":0.4375,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0.8125,"h":0.8125,"d":1.125,"c":1.9375,"total":4.6875},"lh_plus":{"s":0,"h":0.5,"d":0,"c":0.5,"total":1},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0.125},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.8125,"h":1.75,"d":1.125,"c":2.4375,"total":6.125},"total":{"s":0,"h":0,"d":0,"c":0,"total":6.1875}}
+
+K7|KJ532|A42|AK7
+{"lu":{"total":1.5,"s":0,"h":1.5,"d":0,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":0.8125,"h":0.8125,"d":1.125,"c":1.9375,"total":4.6875},"lh_plus":{"s":0,"h":0.5,"d":0,"c":0.5,"total":1},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":-0.0625,"h":0,"d":0,"c":0,"total":-0.0625},"lsz":{"total":0.125},"l10n":{"total":-0.125},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":0.75,"h":2.8125,"d":1.125,"c":2.4375,"total":7.125},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.0625}}
+
+AKxx|ADxx|AWxx|x
+{"lu":{"total":1.3125,"s":0.4375,"h":0.4375,"d":0.4375,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":1.9375,"h":1.5625,"d":1.125,"c":0,"total":4.625},"lh_plus":{"s":0.5,"h":0.5,"d":0.5,"c":0,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":-0,"total":0},"lsz":{"total":0.0625},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0.0625},"subtotal":{"s":2.875,"h":2.5,"d":2.0625,"c":0,"total":7.4375},"total":{"s":0,"h":0,"d":0,"c":0,"total":7.5}}
+
+AWxx|KWxx|DWxx|x
+{"lu":{"total":1.3125,"s":0.4375,"h":0.4375,"d":0.4375,"c":0},"lu_plus":{"total":-0.0625},"lh":{"s":1.125,"h":0.8125,"d":0.4375,"c":0,"total":2.375},"lh_plus":{"s":0.5,"h":0.5,"d":0.5,"c":0,"total":1.5},"lh_10":{"s":0,"h":0,"d":0,"c":0,"total":0},"lh_short":{"s":0,"h":0,"d":0,"c":-0,"total":0},"lsz":{"total":-0.0625},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0.0625},"subtotal":{"s":2.0625,"h":1.75,"d":1.375,"c":0,"total":5.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":5.125}}
+
+AKDW1098765432|||
+{"lu":{"total":10,"s":10,"h":0,"d":0,"c":0},"lu_plus":{"total":0.0625},"lh":{"s":2.375,"h":0,"d":0,"c":0,"total":2.375},"lh_plus":{"s":0.75,"h":0,"d":0,"c":0,"total":0.75},"lh_10":{"s":0.1875,"h":0,"d":0,"c":0,"total":0.1875},"lh_short":{"s":0,"h":0,"d":0,"c":0,"total":0},"lsz":{"total":0},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":13.3125,"h":0,"d":0,"c":0,"total":13.3125},"total":{"s":0,"h":0,"d":0,"c":0,"total":13.375}}
+
+AKDW1098|AK|AK|AK
+{"lu":{"total":3.9375,"s":3.9375,"h":0,"d":0,"c":0},"lu_plus":{"total":0.0625},"lh":{"s":2.375,"h":1.9375,"d":1.9375,"c":1.9375,"total":8.1875},"lh_plus":{"s":0.75,"h":0.5,"d":0.5,"c":0.5,"total":2.25},"lh_10":{"s":0.1875,"h":0,"d":0,"c":0,"total":0.1875},"lh_short":{"s":0,"h":-0.125,"d":-0.125,"c":-0.125,"total":-0.375},"lsz":{"total":0.125},"l10n":{"total":0},"short_suit":{"total":0},"major_suit":{"total":0},"subtotal":{"s":7.25,"h":2.3125,"d":2.3125,"c":2.3125,"total":14.1875},"total":{"s":0,"h":0,"d":0,"c":0,"total":14.375}} \ No newline at end of file