Module embedded_enum_data

Module embedded_enum_data 

Source

Functionsยง

data_carrying_enum_db_schema
Verifies DB columns for a data-carrying enum: discriminant column + one nullable column per variant field, named {disc_col}_{field_name}.
data_carrying_enum_schema
Verifies that a data-carrying enum has its variant fields registered in the app schema with globally-assigned field indices (indices are unique across all variants).
data_variant_roundtrip
End-to-end CRUD test for a data-carrying enum (all variants have fields). Creates records with different variants, reads them back, and verifies roundtrip.
data_variant_with_jiff_timestamp
Tests that jiff::Timestamp fields inside data-carrying enum variants round-trip correctly. Also covers a mixed enum (one unit variant, one data variant) to verify null handling.
data_variant_with_uuid_field
Tests that UUID fields inside data-carrying enum variants round-trip correctly. UUID is a non-trivial primitive that requires type casting on some databases.
enum_in_enum_roundtrip
Roundtrip test for an enum embedded inside a variant field of another enum (enum-in-enum). The inner enum is unit-only; the outer has one data variant and one unit variant.
global_field_indices
Verifies field indices are assigned globally across multiple data variants. With two variants having two fields each, indices should be 0, 1, 2, 3.
mixed_enum_roundtrip
End-to-end CRUD test for a mixed enum (unit variants and data variants). Verifies that both kinds round-trip correctly through the DB.
mixed_enum_schema
Verifies that a mixed enum (some unit variants, some data variants) registers correctly: unit variants have empty fields, data variants have their fields with indices assigned starting from 0 and continuing globally across variants.
struct_in_data_variant