Created
September 23, 2020 18:57
-
-
Save Auraelius/af1413ca8617e9cbac7bc35fd8aa3dd9 to your computer and use it in GitHub Desktop.
felix math test cases from muhajir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balance: cumulative running total of (deposits - expenses) (what the bank knows about my account) | |
goal: a sub-account devoted to a purpose, to be funded periodically in order to reach a predefined amount by a predefined date | |
allowance = money you have available to spend once money has been allocated to your goals from your balance. | |
savings = sum(goals) or aggregate amount of money allocated to all your goals | |
and | |
allowance = balance - savings | |
savings should go up when money is allocated to a goal. savings refers to your savings within the app | |
test case 1: Creating an expense should subtract the amount from balance. | |
PRE: Balance = 100 | |
expense = -10 | |
post | |
balance = 90 | |
test case 2: Creating an expense where the amount is less than or equal to the allowance should subtract the amount from the allowance. | |
pre: | |
balance = 100 | |
allowance = 100 | |
expense = -10 | |
post | |
balance = 90 | |
allowance = 90 | |
test case 3A: Creating an expense where the amount is greater than the allowance should make allowance = 0 (allowance should never be negative). | |
pre: | |
balance = 100 | |
allowance = 100 | |
expense = -110 | |
post | |
balance = -10 | |
allowance = 0 | |
test case 3B: Creating an expense where the amount is greater than the allowance should add the negative difference of (amount + allowance) to the user’s total saved (adding the negative difference will decrease the total amount). | |
pre: | |
balance = 100 | |
allowance = 100 | |
goal 1 = 100/200 (current total/ goal target) | |
goal 2 = 200/300 | |
saved = 300 | |
expense = -110 | |
post | |
balance = -10 | |
saved = 300 +(-110+100) (saved = saved +( expense+allowance)) | |
= 290 | |
deallocation amount = -10 | |
allowance = 0 | |
“expenses will deplete savings before deallocating goals" | |
test case 3C: Creating an expense where the amount is greater than the allowance should deallocate the negative difference of (amount + allowance) from the user’s goals, where each goal is deallocated an amount proportional to it’s ratio to the total saved amount of the user. | |
pre: | |
balance = 100 | |
allowance = 100 | |
goal 1 = 100/200 | |
goal 2 = 200/300 | |
saved = 300 | |
expense = -110 | |
post | |
balance = -10 | |
saved = 300 +(-110+100) (saved = saved +( expense+allowance)) | |
= 190 | |
goal 1 = 96.67/200 ( 100 - (1/3)*10) // deallocated in proportion to previous goal amount / previous savings | |
goal 2 = 193.33/300 (200 - (2/3)*10) | |
Note = rounding to the nearest cent handling: first goal processed gets the extra money to make the whole cent, all others are less that the float amount. | |
allowance = 0 | |
“expenses will deplete savings by reducing goals in proportion to their ratio of goal-balance/savings before deallocating goals" | |
test case 4: Goals should only be deallocated from if their current amount is greater than 0. (edited) | |
pre: | |
balance = 100 | |
allowance = 100 | |
goal 1 = 0/200 | |
goal 2 = 200/300 | |
saved = 200 | |
expense = -110 | |
post | |
balance = -10 | |
saved = 200 +(-110+100) (saved = saved +( expense+allowance)) | |
= 190 | |
goal 1 = 0/200 | |
goal 2 = 190/300 | |
allowance = 0 | |
testing periodic function | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment