

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1
2
3
4
5
7
8
public final class IMath { /**
/** A class to test the class IMath. / public class IMathTestNoJUnit { /* Runs the tests. */ public static void main(String[] args) { printTestResult(0); printTestResult(1); printTestResult(2); printTestResult(3); printTestResult(4); printTestResult(7); printTestResult(9); printTestResult(100); } private static void printTestResult(int arg) { System.out.print(“isqrt(“ + arg + “) ==> “); System.out.println(IMath.isqrt(arg)); } } 10
Isqrt(0) ==> 1 Isqrt(1) ==> 1 Isqrt(2) ==> 2 Isqrt(3) ==> 2 Isqrt(4) ==> 2 Isqrt(7) ==> 3 Isqrt(9) ==> 3 Isqrt(100) ==> 10 What does this say about the code? Is it right? What’s the problem with this kind of test output? 11
12
Definition