package odin-algebra:prop_based

⌘K
Ctrl+K
or
/

    Types

    CheckLoggerData ¶

    CheckLoggerData :: struct {
    	t:          ^testing.T,
    	old_logger: runtime.Logger,
    }

    Generator ¶

    Generator :: struct($T: typeid) {
    	… // See source for fields
    }
     

    Note on implementing your own generator: T: is the expected output type of the generator raw: allows your other functions to access any nessisary state generate: called to generate a random value of type T reduce: called to find a smaller counter example. Given an input of type T it should randomly generate a smaller example that might also fail the proposition. delete: called to free values of type T print: called to print values of type T when the proposition is falsefied

    Related Procedures With Parameters

    PropBasedLogMessage ¶

    PropBasedLogMessage :: struct {
    	level: runtime.Logger_Level,
    	text:  untyped string,
    }

    PropBasedTestState ¶

    PropBasedTestState :: struct {
    	logs:        [dynamic]PropBasedLogMessage,
    	logger:      runtime.Logger,
    	logger_data: CheckLoggerData,
    }

    Constants

    GENERATOR_F32 ¶

    GENERATOR_F32: Generator($T=f32) : Generator(f32){nil, generate_f32, reduce_f32, delete_f32, print_f32}

    GENERATOR_I64 ¶

    GENERATOR_I64: Generator($T=i64) : Generator(i64){nil, generate_i64, reduce_i64, delete_i64, print_i64}

    Variables

    prop_based_test_state ¶

    @(thread_local)
    prop_based_test_state: PropBasedTestState

    Procedures

    check_1 ¶

    check_1 :: proc(
    	t:           ^testing.T, 
    	state:       $S, 
    	g:           Generator($T), 
    	predicate:   proc($S, $T) -> bool, 
    	itterations: untyped integer = 100, 
    	loc := #caller_location, 
    ) {…}

    check_2 ¶

    check_2 :: proc(
    	t:           ^testing.T, 
    	state:       $S, 
    	g_1:         Generator($T), 
    	g_2:         Generator($T), 
    	predicate:   proc($S, $T, $U) -> bool, 
    	itterations: untyped integer = 100, 
    	loc := #caller_location, 
    ) {…}

    check_3 ¶

    check_3 :: proc(
    	t:           ^testing.T, 
    	state:       $S, 
    	g_1:         Generator($T), 
    	g_2:         Generator($T), 
    	g_3:         Generator($T), 
    	predicate:   proc($S, $T, $U, $V) -> bool, 
    	itterations: untyped integer = 100, 
    	loc := #caller_location, 
    ) {…}

    check_debug_assertion_failure_proc ¶

    check_debug_assertion_failure_proc :: proc(prefix, message: untyped string, loc := #caller_location) -> ! {…}

    check_logger_proc ¶

    check_logger_proc :: proc(logger_data_raw: rawptr, level: runtime.Logger_Level, text: untyped string, options: bit_set[runtime.Logger_Option], location := #caller_location) {…}

    delete_f32 ¶

    delete_f32 :: proc(old: f32) {…}

    delete_i64 ¶

    delete_i64 :: proc(old: i64) {…}

    delete_state ¶

    delete_state :: proc() {…}

    generate_f32 ¶

    generate_f32 :: proc(raw: rawptr) -> f32 {…}

    generate_i64 ¶

    generate_i64 :: proc(raw: rawptr) -> i64 {…}

    log_args_1 ¶

    log_args_1 :: proc(a_1: ^$T, g_1: Generator($T)) {…}

    log_args_2 ¶

    log_args_2 :: proc(a_1: ^$T, g_1: Generator($T), a_2: ^$U, g_2: Generator($T)) {…}

    log_args_3 ¶

    log_args_3 :: proc(
    	a_1: ^$T, 
    	g_1: Generator($T), 
    	a_2: ^$U, 
    	g_2: Generator($T), 
    	a_3: ^$V, 
    	g_3: Generator($T), 
    ) {…}
    print_f32 :: proc(sb: ^strings.Builder, f: f32) {…}
    print_falsification :: proc(loc := #caller_location) {…}
    print_i64 :: proc(sb: ^strings.Builder, i: i64) {…}

    reduce_f32 ¶

    reduce_f32 :: proc(raw: rawptr, old: f32) -> f32 {…}

    reduce_i64 ¶

    reduce_i64 :: proc(raw: rawptr, old: i64) -> i64 {…}

    reset_state ¶

    reset_state :: proc(t: ^testing.T) {…}

    Procedure Groups

    check ¶

    check :: proc{
    	check_1,
    	check_2,
    	check_3,
    }
    

    Source Files

    Generation Information

    Generated with odin version dev-2025-04 (vendor "odin") Linux_amd64 @ 2025-05-13 09:15:55.506154180 +0000 UTC