okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffaufperf(stream): validate delta maps without rebuilding them3815558

main
876 B16 linesraw
1%% FFI contracts include Erlang null aliases and tuples that JSON fixtures cannot produce.
2-module(albedo_openai_json_test).
3-include_lib("eunit/include/eunit.hrl").
4
5semantically_empty_test_() ->
6    [?_assertEqual(true, albedo_openai_json:semantically_empty(Value))
7     || Value <- [null, nil, undefined, <<>>, [], {}, #{}]] ++
8    [?_assertEqual(false, albedo_openai_json:semantically_empty(Value))
9     || Value <- [false, true, 0, <<"x">>, [null], {null}, #{<<"id">> => null}]].
10
11object_fields_test_() ->
12    [?_assertEqual({ok, Value}, albedo_openai_json:object_fields(Value))
13     || Value <- [#{}, #{<<"content">> => <<"hello">>, <<"opaque">> => [1, #{}]}]] ++
14    [?_assertEqual({error, #{}}, albedo_openai_json:object_fields(Value))
15     || Value <- [null, [], 42, <<"x">>, #{content => <<"hello">>},
16                  #{<<"content">> => <<"hello">>, 1 => null}]].