summaryrefslogtreecommitdiff
path: root/tests/test_core.c
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-22 22:48:14 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-22 22:48:14 +0200
commitca267e6b1c727be254c6229fc1ed3e2c5a0d6065 (patch)
tree1182e2d8efa3c0c8f1103e841132230341b83cfa /tests/test_core.c
parentfd08102a4be4e1f26c7afe005842002da923b987 (diff)
downloadbokf-0.1.67.tar.gz
bokf-0.1.67.zip
sru, tui: round every account to whole kronor; fix the årsredovisning Stäng skipv0.1.67
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_core.c')
-rw-r--r--tests/test_core.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/test_core.c b/tests/test_core.c
index c9c969e..071b5ce 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -1654,6 +1654,15 @@ static void test_imported_closings(struct tctx *t)
free(sru);
yyjson_doc_free(d);
+ /* the huvudbok tells imported rows apart, for the TUI årsredovisning */
+ d = call(reqf("{\"v\":1,\"id\":\"ic9a\",\"cmd\":\"report.general_ledger\","
+ "\"session\":\"%s\",\"org\":%d,\"args\":{\"accounts\":"
+ "[\"3001\"]}}",
+ g_session, (int)org));
+ CHECK_OK(d);
+ CHECK_STR(d, "result.accounts.0.rows.0.source", "sie_import");
+ yyjson_doc_free(d);
+
/* a voucher entered in bokf is never skipped, whatever its text */
d = call(reqf("{\"v\":1,\"id\":\"ic10\",\"cmd\":\"voucher.post\","
"\"session\":\"%s\",\"org\":%d,\"args\":{\"date\":"
@@ -4520,22 +4529,28 @@ static void test_sru(struct tctx *t)
CHECK(strstr(sru, "#UPPGIFT 7410 1500") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7513 80") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7525 500") != NULL);
- CHECK(strstr(sru, "#UPPGIFT 7528 168") != NULL);
+ /* every account rounds to whole kronor before it is summed, so the
+ fields add up: 1500 - 100 - 80 - 500 - 169 = 651 and
+ 1875 = 651 + 500 + 200 + 355 + 169 */
+ CHECK(strstr(sru, "#UPPGIFT 7528 169") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7450 651") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7281 1875") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7369 355") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7321 500") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7302 651") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7650 651") != NULL);
- CHECK(strstr(sru, "#UPPGIFT 7651 168") != NULL);
+ CHECK(strstr(sru, "#UPPGIFT 7651 169") != NULL);
CHECK(strstr(sru, "#UPPGIFT 7653 100") != NULL);
- CHECK(strstr(sru, "#UPPGIFT 7670 919") != NULL);
- CHECK(strstr(sru, "#UPPGIFT 7104 919") != NULL);
+ CHECK(strstr(sru, "#UPPGIFT 7368 169") != NULL);
+ CHECK(strstr(sru, "#UPPGIFT 7670 920") != NULL);
+ CHECK(strstr(sru, "#UPPGIFT 7104 920") != NULL);
CHECK(strstr(sru, "#FIL_SLUT") != NULL);
free(sru);
CHECK_STR(d, "result.from", "2026-01-01");
CHECK(find_amount(d, "result.ink2r", "code", "7281", "amount") == 1875);
- CHECK(find_amount(d, "result.ink2s", "code", "7670", "amount") == 919);
+ CHECK(find_amount(d, "result.ink2s", "code", "7670", "amount") == 920);
+ CHECK(util_round_kr(150) == 200 && util_round_kr(149) == 100);
+ CHECK(util_round_kr(-150) == -200 && util_round_kr(-149) == -100);
yyjson_doc_free(d);
d = call(reqf("{\"v\":1,\"id\":\"126\",\"cmd\":\"sru.export\","