|
| 1 | +<?php |
| 2 | +namespace PHPJava\Tests; |
| 3 | + |
| 4 | +use PHPJava\Kernel\Types\_Double; |
| 5 | +use PHPJava\Kernel\Types\_Float; |
| 6 | +use PHPJava\Kernel\Types\_Int; |
| 7 | +use PHPJava\Kernel\Types\_Long; |
| 8 | + |
| 9 | +class NegationTest extends Base |
| 10 | +{ |
| 11 | + protected $fixtures = [ |
| 12 | + 'NegationTest', |
| 13 | + ]; |
| 14 | + |
| 15 | + private function call($method, ...$arguments) |
| 16 | + { |
| 17 | + $calculatedValue = $this->initiatedJavaClasses['NegationTest'] |
| 18 | + ->getInvoker() |
| 19 | + ->getStatic() |
| 20 | + ->getMethods() |
| 21 | + ->call( |
| 22 | + $method, |
| 23 | + ...$arguments |
| 24 | + ); |
| 25 | + |
| 26 | + return $calculatedValue->getValue(); |
| 27 | + } |
| 28 | + |
| 29 | + public function testNegateIntPattern1() |
| 30 | + { |
| 31 | + $actual = $this->call( |
| 32 | + 'negateInt', |
| 33 | + _Int::get(123) |
| 34 | + ); |
| 35 | + $this->assertEquals('-123', $actual); |
| 36 | + } |
| 37 | + |
| 38 | + public function testNegateIntPattern2() |
| 39 | + { |
| 40 | + $actual = $this->call( |
| 41 | + 'negateInt', |
| 42 | + _Int::get(-123) |
| 43 | + ); |
| 44 | + $this->assertEquals('123', $actual); |
| 45 | + } |
| 46 | + |
| 47 | + public function testNegateDoublePattern1() |
| 48 | + { |
| 49 | + $actual = $this->call( |
| 50 | + 'negateDouble', |
| 51 | + _Double::get(123) |
| 52 | + ); |
| 53 | + $this->assertEquals('-123', $actual); |
| 54 | + } |
| 55 | + |
| 56 | + public function testNegateDoublePattern2() |
| 57 | + { |
| 58 | + $actual = $this->call( |
| 59 | + 'negateDouble', |
| 60 | + _Double::get(-123) |
| 61 | + ); |
| 62 | + $this->assertEquals('123', $actual); |
| 63 | + } |
| 64 | + |
| 65 | + public function testNegateDoublePattern3() |
| 66 | + { |
| 67 | + $actual = $this->call( |
| 68 | + 'negateDouble', |
| 69 | + _Double::get(123.5) |
| 70 | + ); |
| 71 | + $this->assertEquals('-123.5', $actual); |
| 72 | + } |
| 73 | + |
| 74 | + public function testNegateDoublePattern4() |
| 75 | + { |
| 76 | + $actual = $this->call( |
| 77 | + 'negateDouble', |
| 78 | + _Double::get(-123.5) |
| 79 | + ); |
| 80 | + $this->assertEquals('123.5', $actual); |
| 81 | + } |
| 82 | + |
| 83 | + public function testNegateFloatPattern1() |
| 84 | + { |
| 85 | + $actual = $this->call( |
| 86 | + 'negateFloat', |
| 87 | + _Float::get(123) |
| 88 | + ); |
| 89 | + $this->assertEquals('-123', $actual); |
| 90 | + } |
| 91 | + |
| 92 | + public function testNegateFloatPattern2() |
| 93 | + { |
| 94 | + $actual = $this->call( |
| 95 | + 'negateFloat', |
| 96 | + _Float::get(-123) |
| 97 | + ); |
| 98 | + $this->assertEquals('123', $actual); |
| 99 | + } |
| 100 | + |
| 101 | + public function testNegateFloatPattern3() |
| 102 | + { |
| 103 | + $actual = $this->call( |
| 104 | + 'negateFloat', |
| 105 | + _Float::get(123.5) |
| 106 | + ); |
| 107 | + $this->assertEquals('-123.5', $actual); |
| 108 | + } |
| 109 | + |
| 110 | + public function testNegateFloatPattern4() |
| 111 | + { |
| 112 | + $actual = $this->call( |
| 113 | + 'negateFloat', |
| 114 | + _Float::get(-123.5) |
| 115 | + ); |
| 116 | + $this->assertEquals('123.5', $actual); |
| 117 | + } |
| 118 | + |
| 119 | + public function testNegateLongPattern1() |
| 120 | + { |
| 121 | + $actual = $this->call( |
| 122 | + 'negateLong', |
| 123 | + _Long::get(123) |
| 124 | + ); |
| 125 | + $this->assertEquals('-123', $actual); |
| 126 | + } |
| 127 | + |
| 128 | + public function testNegateLongPattern2() |
| 129 | + { |
| 130 | + $actual = $this->call( |
| 131 | + 'negateLong', |
| 132 | + _Long::get(-123) |
| 133 | + ); |
| 134 | + $this->assertEquals('123', $actual); |
| 135 | + } |
| 136 | +} |
0 commit comments