1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class CustomFeaturesTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class CustomFeaturesTest
- {
-
- private Console console = new Console();
- private CustomFeatures custom = new CustomFeatures(console);
- @Test
- public void addFiveTest()
- {
-
- console.changeCurrentValue(5);
-
- double testAddFive = custom.addFive();
- assertEquals(10, testAddFive, 0);
- }
-
- @Test
- public void helpTest()
- {
-
- String testHelp = custom.helpMe();
- assertEquals(("Welcome to the help file! \n" + " \n" +
-
- "All of the available commands are listed below \n" +
- "with a short description for each command. \n" + " \n" +
-
- "Basic Commands: \n"+
- "getValue -> shows you the current stored value in the calculator \n" +
- "clear -> resets the current value to 0 \n" +
- "changeValue -> sets the current value to a user defined number \n" +
- "add -> adds current value to a user defined number \n" +
- "subtract -> subtracts a user defined number from the current value \n" +
- "multiply -> multiplies the current value by a user defined number \n" +
- "divide -> divides current value by a user defined number \n"+
- "square -> squares the current value (current value to the 2nd power) \n" +
- "SQRT -> calculates the square root of the current value \n" +
- "inverse-> calculates 1/(current value) \n" +
- "invert -> switches value of current value to negative or vice versa \n" +
- "variableEx -> calculates the current value to the user defined power \n" +" \n" +
-
- "Scientific Commands: \n" +
- "switchDisplayMode -> changes display mode to binary, octal, decimal, hexadecimal \n" +
- "M+ -> Add the currently displayed value to the value in memory \n" +
- "MC -> resets memory value to 0 \n" +
- "MRC -> recalls the stored memory value \n" +
- "sine -> Calculate the sine of the current value \n" +
- "cosine -> Calculate the cosine of the current value \n" +
- "tangent -> Calculate the tangent of the current value \n" +
- "inverseSine -> 1/(sine of current value) \n" +
- "inverseCosine -> 1/(cosine of current value) \n" +
- "inverseTangent -> 1/(tangent of current value) \n" +
- "switchUnitsMode -> sets trig units to Degrees or Radians \n" + " \n" +
-
- "Bonus Features: \n" +
- "factorial -> calculates the factorial of the current value \n" +
- "log -> calculates the log of the current value \n" +
- "inverseLog -> calculates 10^(current value) \n" +
- "LN -> calculates the natural logarithm of the current value \n" +
- "inverseLN -> calculates e^(current value) \n" + " \n" +
-
- "Custom Features: \n" +
- "addFive -> sets current value to result of five plus the current value \n" +
- "help -> displays this help file \n" +
- "exit -> closes the calculator \n"), testHelp);
- }
- }
|