コード例 #1
0
 public function testStringCalculatorException()
 {
     $this->setExpectedException("Exception");
     $calculator = new StringCalculator();
     $calculator->add("-3,1");
 }
コード例 #2
0
 public function testMultipleDelimitersLongerThanOneChar()
 {
     $stringCalculator = new StringCalculator();
     $actual = $stringCalculator->add("//[ññ][éé]\n1ññ2éé1040ññ10344");
     $this->assertEquals(3, $actual);
 }
コード例 #3
0
 public function test_it_accepts_new_line_characters_as_a_delimiter()
 {
     $result = StringCalculator::add('2\\n 3, 3');
     $this->assertEquals(8, $result);
 }
コード例 #4
0
 public function test_add_with_multiple_custom_delimiters_with_multiple_characters()
 {
     $this->assertEquals(5, $this->calc->add("//[qq][;z]\n0qq1;z4"));
     $this->assertEquals(11, $this->calc->add("//[z][aa][qqq]\n1z2aa7qqq1"));
 }