Class ProfileTest


  • public class ProfileTest
    extends Object
    Test the Profile class.
    • Constructor Detail

      • ProfileTest

        public ProfileTest()
    • Method Detail

      • profileTestUsingTrigFunctions

        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 - double; the argument
      • doCosine

        public void doCosine​(double angle)
        Perform a somewhat CPU time intensive function.
        Parameters:
        angle - double; the argument
      • profileTestUsingBusyWaiting

        public void profileTestUsingBusyWaiting()
                                         throws InterruptedException
        Test the Profile class using busy waiting.
        Throws:
        InterruptedException - if that happens; this test has failed
      • delay

        public long delay​(long nanoSeconds)
                   throws InterruptedException
        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 - long; time to delay in nano seconds
        Returns:
        long; number of iterations in the busy waiting loop
        Throws:
        InterruptedException - If that happens; this test fails
      • testFailureModes

        public void testFailureModes()
        Test handling of inappropriate calling sequences.
      • startOnly

        public void startOnly()
        Calls start, but not end.