Package org.djutils.profile
Class ProfileTest
java.lang.Object
org.djutils.profile.ProfileTest
Test the Profile class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongdelay(long nanoSeconds) Delay for specified number of nano seconds.voiddoCosine(double angle) Perform a somewhat CPU time intensive function.voiddoSine(double angle) Perform a somewhat CPU time intensive function.voidTest the Profile class using busy waiting.voidTest the Profile class using sine and cosine.voidCalls start, but not end.voidTest handling of inappropriate calling sequences.
-
Constructor Details
-
ProfileTest
public ProfileTest()
-
-
Method Details
-
profileTestUsingTrigFunctions
@Test public void profileTestUsingTrigFunctions()Test the Profile class using sine and cosine. -
doSine
public void doSine(double angle) Perform a somewhat CPU time intensive function.- Parameters:
angle- the argument
-
doCosine
public void doCosine(double angle) Perform a somewhat CPU time intensive function.- Parameters:
angle- the argument
-
profileTestUsingBusyWaiting
Test the Profile class using busy waiting.- Throws:
InterruptedException- if that happens; this test has failed
-
delay
Delay for specified number of nano seconds.
Derived from https://stackoverflow.com/questions/11498585/how-to-suspend-a-java-thread-for-a-small-period-of-time-like-100-nanoseconds- Parameters:
nanoSeconds- time to delay in nano seconds- Returns:
- number of iterations in the busy waiting loop
- Throws:
InterruptedException- If that happens; this test fails
-
testFailureModes
@Test public void testFailureModes()Test handling of inappropriate calling sequences. -
startOnly
public void startOnly()Calls start, but not end.
-