Add watch/phone icons and logo, reorder the interpretation report, and stamp every report with the day it's for
build / build (push) Successful in 30s
build / build (push) Successful in 30s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../src/json.h"
|
||||
#include "../src/reading_io.h"
|
||||
@@ -48,6 +49,7 @@ static void test_json_parse_rejects_malformed(void) {
|
||||
* absent entirely, to prove partial spread data doesn't fail the load. */
|
||||
static const char *k_fixture =
|
||||
"{"
|
||||
" \"date\": \"2026-07-16\","
|
||||
" \"natal\": {\"bodies\": [{\"body\": \"sun\", \"sign\": \"taurus\", \"house\": 3}], \"houses\": []},"
|
||||
" \"transits\": {"
|
||||
" \"bodies\": [{\"body\": \"sun\", \"sign\": \"cancer\", \"house\": 5}],"
|
||||
@@ -80,6 +82,30 @@ static void test_reading_load_json_extracts_aspects(void) {
|
||||
printf("PASS test_reading_load_json_extracts_aspects\n");
|
||||
}
|
||||
|
||||
static void test_reading_load_json_extracts_date(void) {
|
||||
DailyReading reading;
|
||||
bool ok = reading_load_json(k_fixture, strlen(k_fixture), &reading);
|
||||
|
||||
assert(ok);
|
||||
struct tm *utc = gmtime(&reading.utc_moment);
|
||||
assert(utc->tm_year + 1900 == 2026);
|
||||
assert(utc->tm_mon + 1 == 7);
|
||||
assert(utc->tm_mday == 16);
|
||||
|
||||
printf("PASS test_reading_load_json_extracts_date\n");
|
||||
}
|
||||
|
||||
static void test_reading_load_json_missing_date_defaults_to_zero(void) {
|
||||
const char *text = "{\"transits\": {\"aspects\": []}}";
|
||||
DailyReading reading;
|
||||
bool ok = reading_load_json(text, strlen(text), &reading);
|
||||
|
||||
assert(ok);
|
||||
assert(reading.utc_moment == 0);
|
||||
|
||||
printf("PASS test_reading_load_json_missing_date_defaults_to_zero\n");
|
||||
}
|
||||
|
||||
static void test_reading_load_json_extracts_body_sign_and_house(void) {
|
||||
DailyReading reading;
|
||||
bool ok = reading_load_json(k_fixture, strlen(k_fixture), &reading);
|
||||
@@ -178,6 +204,8 @@ int main(void) {
|
||||
test_json_parse_basic_shapes();
|
||||
test_json_parse_rejects_malformed();
|
||||
test_reading_load_json_extracts_aspects();
|
||||
test_reading_load_json_extracts_date();
|
||||
test_reading_load_json_missing_date_defaults_to_zero();
|
||||
test_reading_load_json_extracts_body_sign_and_house();
|
||||
test_reading_load_json_extracts_spread_positions();
|
||||
test_reading_load_json_missing_spread_is_not_fatal();
|
||||
|
||||
Reference in New Issue
Block a user