Adding gender to the config
build / build (push) Successful in 19s

This commit is contained in:
ml
2026-07-16 22:49:06 +02:00
parent 1ebbfebe31
commit 7a77c4a07d
26 changed files with 470 additions and 109 deletions
+36
View File
@@ -50,6 +50,7 @@ static void test_json_parse_rejects_malformed(void) {
static const char *k_fixture =
"{"
" \"date\": \"2026-07-16\","
" \"gender\": \"female\","
" \"natal\": {\"bodies\": [{\"body\": \"sun\", \"sign\": \"taurus\", \"house\": 3}], \"houses\": []},"
" \"transits\": {"
" \"bodies\": [{\"body\": \"sun\", \"sign\": \"cancer\", \"house\": 5}],"
@@ -106,6 +107,38 @@ static void test_reading_load_json_missing_date_defaults_to_zero(void) {
printf("PASS test_reading_load_json_missing_date_defaults_to_zero\n");
}
static void test_reading_load_json_extracts_gender(void) {
DailyReading reading;
bool ok = reading_load_json(k_fixture, strlen(k_fixture), &reading);
assert(ok);
assert(reading.gender == GENDER_FEMALE);
printf("PASS test_reading_load_json_extracts_gender\n");
}
static void test_reading_load_json_missing_gender_defaults_to_unspecified(void) {
const char *text = "{\"transits\": {\"aspects\": []}}";
DailyReading reading;
bool ok = reading_load_json(text, strlen(text), &reading);
assert(ok);
assert(reading.gender == GENDER_UNSPECIFIED);
printf("PASS test_reading_load_json_missing_gender_defaults_to_unspecified\n");
}
static void test_reading_load_json_unrecognized_gender_defaults_to_unspecified(void) {
const char *text = "{\"gender\": \"xenu\", \"transits\": {\"aspects\": []}}";
DailyReading reading;
bool ok = reading_load_json(text, strlen(text), &reading);
assert(ok);
assert(reading.gender == GENDER_UNSPECIFIED);
printf("PASS test_reading_load_json_unrecognized_gender_defaults_to_unspecified\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);
@@ -206,6 +239,9 @@ int main(void) {
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_gender();
test_reading_load_json_missing_gender_defaults_to_unspecified();
test_reading_load_json_unrecognized_gender_defaults_to_unspecified();
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();