14488_v2-test.diff

Administrator Admin, 2010-05-29 11:38

Download (1.26 KB)

View differences:

tests/t3lib/t3lib_div_testcase.php (working copy)
59 59
	/**
60 60
	 * @test
61 61
	 */
62
	public function calcPriorityCalculatesBasicArithmeticOperation() {
63
		$this->assertEquals(9, t3lib_div::calcPriority('6 + 3'));
64
		$this->assertEquals(3, t3lib_div::calcPriority('6 - 3'));
65
		$this->assertEquals(-3, t3lib_div::calcPriority('3 - 6'));
66
		$this->assertEquals(6, t3lib_div::calcPriority('2 * 3'));
67
		$this->assertEquals(2.5, t3lib_div::calcPriority('5 / 2'));
68
		$this->assertEquals(1, t3lib_div::calcPriority('5 % 2'));
69
		$this->assertEquals(8, t3lib_div::calcPriority('2 ^ 3'));
70
	}
71

  
72
	/**
73
	 * @test
74
	 */
75
	public function calcPriorityCalculatesArithmeticOperationWithMultipleOperands() {
76
		$this->assertEquals(6.5, t3lib_div::calcPriority('5 + 3 / 2'));
77
		$this->assertEquals(14, t3lib_div::calcPriority('5 + 3 ^ 2'));
78
		$this->assertEquals(4, t3lib_div::calcPriority('5 % 2 + 3'));
79
		$this->assertEquals(3, t3lib_div::calcPriority('2 + 6 / 2 - 2'));
80
	}
81

  
82
	/**
83
	 * @test
84
	 */
62 85
	public function checkIntExplodeConvertsStringsToInteger() {
63 86
		$testString = '1,foo,2';
64 87
		$expectedArray = array(1, 0, 2);