15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @summary Calculates Fibonacci numbers "recursively" via threads and compares
27 * the result with the classical calculation.
28 * This test is skipped on 32-bit Windows: limited virtual space on Win-32
29 * make this test inherently unstable on Windows with 32-bit VM data model.
30 * @requires !(os.family == "windows" & sun.arch.data.model == "32")
31 * @library /testlibrary
32 * @run main Fibonacci 15
33 */
34
35 import com.oracle.java.testlibrary.Asserts;
36
37 public class Fibonacci extends Thread {
38 private int index;
39 private int value;
40 private Fibonacci left;
41 private Fibonacci right;
42
43 public Fibonacci(int i) {
44 index = i;
45 }
46
47 private int getValue() {
48 return value;
49 }
50
51 @Override
52 public void run() {
53 if (index == 0 || index == 1) {
54 // base cases, 0 Fibonacci number = 0, 1 Fibonacci number = 1
55 value = index;
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @summary Calculates Fibonacci numbers "recursively" via threads and compares
27 * the result with the classical calculation.
28 * This test is skipped on 32-bit Windows: limited virtual space on Win-32
29 * make this test inherently unstable on Windows with 32-bit VM data model.
30 * @requires !(os.family == "windows" & sun.arch.data.model == "32")
31 * @library /testlibrary
32 * @run main Fibonacci 15
33 */
34
35 import jdk.test.lib.Asserts;
36
37 public class Fibonacci extends Thread {
38 private int index;
39 private int value;
40 private Fibonacci left;
41 private Fibonacci right;
42
43 public Fibonacci(int i) {
44 index = i;
45 }
46
47 private int getValue() {
48 return value;
49 }
50
51 @Override
52 public void run() {
53 if (index == 0 || index == 1) {
54 // base cases, 0 Fibonacci number = 0, 1 Fibonacci number = 1
55 value = index;
|