File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,16 @@ public static function abs($number)
1616 {
1717 return abs ($ number );
1818 }
19+
20+ /**
21+ * This decrease 1 from parameters
22+ *
23+ * @see https://docs.oracle.com/javase/jp/8/docs/api/java/lang/Math.html#decrementExact-int-
24+ * @param int $a
25+ * @return int
26+ */
27+ public static function decrementExact ($ a )
28+ {
29+ return $ a - 1 ;
30+ }
1931}
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Tests ;
3+
4+ use PHPJava \Core \JavaArchive ;
5+ use PHPUnit \Framework \TestCase ;
6+
7+ class ImitateJavaLangMathTest extends Base
8+ {
9+ protected $ fixtures = [
10+ 'ImitateJavaLangMathTest ' ,
11+ ];
12+
13+ public function testDecrementExact ()
14+ {
15+ ob_start ();
16+ $ this ->initiatedJavaClasses ['ImitateJavaLangMathTest ' ]
17+ ->getInvoker ()
18+ ->getStatic ()
19+ ->getMethods ()
20+ ->call (
21+ 'decrementExact ' ,
22+ 1234
23+ );
24+ $ value = (int ) ob_get_clean ();
25+ $ this ->assertEquals (1233 , $ value );
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ class ImitateJavaLangMathTest
2+ {
3+ public static void decrementExact (int a )
4+ {
5+ System .out .println (Math .decrementExact (a ));
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments