aboutsummaryrefslogtreecommitdiff
path: root/budget/tests/budget.rs
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-10-09 23:51:37 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2020-10-09 23:51:37 +0300
commitc1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f (patch)
tree4cc9f11cdee92b9d50cb2ff240c8d64d475fbe32 /budget/tests/budget.rs
parent742b9fa46d74762f58ae939afd980a532cc4636f (diff)
downloadfinbudg-c1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f.tar.gz
finbudg-c1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f.zip
take into account shared expenses
Diffstat (limited to 'budget/tests/budget.rs')
-rw-r--r--budget/tests/budget.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/budget/tests/budget.rs b/budget/tests/budget.rs
index feae240..6a9214d 100644
--- a/budget/tests/budget.rs
+++ b/budget/tests/budget.rs
@@ -31,7 +31,7 @@ fn can_parse_account() -> Result<(), ParseError>{
name: String::from("Bacon"),
price: 3.33,
qty: 1,
- shared: 2,
+ shared: 3,
recurring: false,
category: Some(String::from("products")),
},
@@ -39,7 +39,7 @@ fn can_parse_account() -> Result<(), ParseError>{
name: String::from("Yoghurt"),
price: 1.24,
qty: 2,
- shared: 1,
+ shared: 2,
recurring: false,
category: Some(String::from("products")),
},
@@ -106,6 +106,7 @@ fn can_calculate() -> Result<(), ParseError> {
categories_subtotal: HashMap::<String, f64>::new(),
total: 22.71,
balance: 397.29,
+ total_owed: HashMap::<u32, f64>::new(),
days_left: 69.9762219286658,
days_left_essential: 84.08253968253969,
last_day: NaiveDate::from_ymd(2020, 10, 04),
@@ -145,6 +146,15 @@ fn can_calculate() -> Result<(), ParseError> {
5.0,
);
+ should_be.total_owed.insert(
+ 2,
+ 1.7599999999999998,
+ );
+ should_be.total_owed.insert(
+ 3,
+ 2.22,
+ );
+
let account = budget::parse_account("tests/test.toml")?;
let actually_is = budget::calculate(&account).unwrap();