12331002 陈果
12331015 孟泽宇
Task 2: Design test cases for version 1
TerpCalc Version1
TerpCalc有三种模式:
- Standard
- Graphic
- Scientific
每一种模式对应一个window,共三个window
Standard模式
- operator1
Operator | Perform-a-simple-calculation |
---|---|
Parameters | First number:[0-9]; button:[+, -, *, /, C]; second number:[0-9] |
Precondition | Set the calculator as the initialization state |
Effects | Get a result |
Test case:
- Calculate 1 + 1
- Calculate 1 - 1
- Calculate 2 * 2
- Calculate 4 / 2
- Calculate 1 / 0
- Calculate 2 * 0
State machine:
- operator2
Operator | Use-the-memory |
---|---|
Parameters | number:[0-9]; button:[MS, MR, MC, M+] |
Precondition | the memory is empty |
Effects | the number is in the memory or removed from the memory |
Test case:
- Input a number and store it in the memory
- Recall the number from the memory
- Remove the number from the memory
- Add a number into the memory
State machine:
- operator3
Operator | Perform-the-square-root-calculation |
---|---|
Parameters | number:[0-9]; button:[sqrt] |
Precondition | Set the calculator as the initialization state |
Effects | Get the square root |
Test case:
- Calculate sqrt(9)
- Calculate sqrt(-9)
- Calculate sqrt(0)
- Calculate sqrt(1/9)
- Calculate sqrt(-1/9)
- Calculate sqrt(3)
State machine:
- operator4
Operator | Format-the-number |
---|---|
Parameters | number:[0-9]; button:[Digital Grouping] |
Precondition | null |
Effects | the number is convert to another format |
Test case:
- Input 1234 then format it
- Input 123 then format it
State machine: