# Qtopia/Calculator

## Test cases

### Backspace and clear

Test Purpose | Verify that numbers in the editor can be edited before applying an operation..

Test Description

1. Go to "Scientific" mode
2. Enter12.567
3. Press backspace two times
4. Verify that the number shown is 12.5
5. Press + , enter 4.3 and Press =
6. Verify that the calculated value == 16.8
7. Go to "Simple" mode
8. Press CE/C
9. Verify that the input is cleared (to 0)
10. Enter 1.234567890
11. Open the softkeyboard
12. Verify that all buttons are visible and the entered value is still correct
13. Press <- (backspace) on the softkeyboard
14. Verify that the last digit (0) is gone
15. Use the softkeyboard again to press -, to enter 0.234567899
16. Press <- (backspace) on the softkeyboard
17. Verify that the last digit (9) is gone
18. Press = on the softkeyboard
19. Verify that the calculated value == 0.9999999999999999 (rounding takes place)
20. Press CE/C
21. Enter10
22. Press X
23. Enter 8
24. Press CE/C
25. Enter 7
26. Press =
27. Verify the calculated value == 70

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match, For floating point numbers a rounding may take place.
Test Suitability | Manual test

### Binary operations

Test Purpose | Verify that binary operations work correctly.

Test Description

1. Press CE/C
2. Enter an input data 1 value
3. Tap on the operator
4. Enter an input data 2 value
5. Tap on =
6. Verify the Expected Result
7. Repeat the above for all testdata

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test

Input data 1 | operator | Input data 2 | Expected result
--- | --- | --- | ---
0 | + | 0 | 0
0 | + | 1 | 1
-2 | + | 1 | -1
-0.56789 | + | 7 | 6.43211
6 | + | -3 | 3
0 | - | 0 | 0
1 | - | 5 | -4
9 | - | -9 | 18
255 | - | 1 | 254
0.3456 | - | 1.345 | -0.9994
5 | / | 0 | Infinity
10 | / | 1 | 10
8 | / | 0.1 | 80
1024 | / | 0.25 | 4096
3.43758 | / | -2.45 | -1.40309387755102
482 | * | 5.67 | 2732.94
10 | * | 0 | 0
65598 | * | -0.1 | -6559,8
-2 | * | -5.25 | 10.5
-834759 | * | 2984205 | -2491091981595
1 | x^y | 1 | 1
1 | x^y | 2 | 1
0 | x^y | 2 | 0
2 | x^y | 8 | 256
16 | x^y | 2 | 256
2 | x^y | 16 | 65536

### Keyboard Interface

Test Purpose | Verify that the keyboard can be used to enter values and that simple operations can be executed using the keyboard.

Test Description

1. Open the hard keyboard
2. Enter 01234567890
3. Verify that each value is shown on the screen
4. Use <- (backspace) to delete some digits
5. Verify that the digits are deleted.
6. Enter 34.5 + 3 =
7. Verify result == 37.5
8. Check some more calculations using the hardkeys and operation +, - and x.

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test

### Memory Operations

Test Purpose | Verify the memory store, recall and clear functions.

Test Description

1. Switch to simple mode
2. Enter a number
3. press M+ to save it to memory.
4. Verify that the m sign appears on the left side of the display.
5. Clear the display.
6. Verify that the m sign is still visible
7. Press MR to retrieve the number entered.
8. Enter another number.
9. Press M+ to add it to the number already saved in memory.
10. Clear the display.
11. Press MR to retrieve the total of the two numbers entered.
12. Press MC
13. Verify that the m sign on the left of the display disappears
14. Enter a 5
15. Press MR
16. Verify that the display shows a 0 (zero)
17. Repeat the same test in Scientific mode.

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test

### Recent Plugin

Test Purpose | Verify that the last used plugin is loaded again the next time Calculator is started

Test Description

1. Start Calculator.
2. Select a different plugin from the one currently active.
3. Close Calculator.
4. Start Calculator.
5. Ensure the last selected plugin is now active.
6. Repeat the same again for the other available plugin(s).

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test

### Unary Operations

Test Purpose | Verify that unary operations in scientific mode work correctly.

Test Description

1. Press CE/C
2. Enter an input data value
3. Tap on the operator
4. Verify the Expected Result
5. Repeat the above for all testdata

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test

Input data | operator | Expected result
--- | --- | ---
9 | sqrt | 3
3 | sqrt | 1.732050807568877
-1 | sqrt | Not a number
2 | ln | 0.6931471805599453
255 | ln | 5.541263545158426
-1 | ln | Not a number
1 | +/- | -1
0 | n! | 1
1 | n! | 1
4 | n! | 24
100 | n! | 9.332621544394418e+157
-1 | n! | Not a positive number
0 | x^2 | 0
1 | x^2 | 1
2 | x^2 | 4
254 | x^2 | 64516
123456789 | x^2 | 1.524157875019052e+16
987654321 | x^2 | 9.754610577899711e+17
0 | e^x | 1
1 | e^x | 2.718281828459045
2 | e^x | 7.38905609893065
255 | e^x | 5.560231647727676e+110
-1 | e^x | 0.3678794411714423
-10 | e^x | 4.539992976248485e-05
0 | 1/x | Infinity
1 | 1/x | 1
2 | 1/x | 0.5
0 | sin | 0
1.570796326794895 (1/2 PI) | sin | 1
0.7853981633974475 (1/4 PI) | sin | 0.7071067811865469
3.14159265358979 (PI) | sin | 3.231089148865173e-15 (approximates 0)
-1.570796326794895 (-1/2 PI) | sin | -1
-0.7853981633974475 (-1/4 PI) | sin | -0.7071067811865469
1 | asin | 1.570796326794897
-1 | asin | -1.570796326794897
0 | cos | 1
1.570796326794895 (1/2 PI) | cos | 1.615544574432587e-15 (approximates 0)
0.7853981633974475 (1/4 PI) | cos | 0.7071067811865481
3.14159265358979 (PI) | cos | -1
3.926990816987237 | cos | -0.7071067811865505

### Standard plugins

Test Purpose | Verify that the standard calculator provides the simple and scientific plugins

Test Description

1. Tap on the combobox just below the edit field.
2. Verify that at least "simple" and "scientific" are offered.
3. Select both options and verify that the display changes according to the selected plugin.

Expected TestResult | All the verification steps as described in the Test Description must be met.
Testnorm/Criteria | Exact Match
Test Suitability | Manual test