disappointment

This commit is contained in:
Masashi 2025-12-16 02:06:58 +05:30
commit 216ef6b45a

View file

@ -0,0 +1,60 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
struct Box_string {
struct T value;
};
struct Option_bool_union {
struct Option_bool_Some some;
struct Option_bool_None none;
};
struct Option_int_union {
struct Option_int_Some some;
struct Option_int_None none;
};
struct Option_int_None {
};
struct Option_int {
int discriminant;
struct Option_int_union data;
};
struct Option_int_Some {
struct T field_0;
};
struct Option_bool_None {
};
struct Option_bool {
int discriminant;
struct Option_bool_union data;
};
struct Option_bool_Some {
struct T field_0;
};
struct Box_int {
struct T value;
};
int test_containers(void);
int test_containers(void) {
struct Box box_int = (struct Box){ .value = 42 };
struct Box box_string = (struct Box){ .value = "Fermented" };
struct Option some_int = (Option){ .discriminant = 0, .data = { .some = (Option_Some{ .field_0 = 10 }) } };
struct Option some_bool = (Option){ .discriminant = 0, .data = { .some = (Option_Some{ .field_0 = true }) } };
struct T unwrapped = unwrap(some_int);
struct T unwraped_bool = unwrap(some_bool);
return (box_int.value + unwrapped);
}