-module(glenv@internal@parse_test). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([main/0, parse_bool_test/0, parse_float_test/0, parse_int_test/0, parse_string_test/0]). -spec main() -> nil. main() -> gleeunit:main(). -spec parse_bool_test() -> nil. parse_bool_test() -> _pipe = glenv@internal@parse:bool(<<"GLENV_TEST_VAR"/utf8>>, <<"yes"/utf8>>), gleeunit_ffi:should_equal( _pipe, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@1 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"YES"/utf8>> ), gleeunit_ffi:should_equal( _pipe@1, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@2 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"yEs"/utf8>> ), gleeunit_ffi:should_equal( _pipe@2, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@3 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"true"/utf8>> ), gleeunit_ffi:should_equal( _pipe@3, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@4 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"TRUE"/utf8>> ), gleeunit_ffi:should_equal( _pipe@4, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@5 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"trUE"/utf8>> ), gleeunit_ffi:should_equal( _pipe@5, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@6 = glenv@internal@parse:bool(<<"GLENV_TEST_VAR"/utf8>>, <<"1"/utf8>>), gleeunit_ffi:should_equal( _pipe@6, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(true)}} ), _pipe@7 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"no"/utf8>> ), gleeunit_ffi:should_equal( _pipe@7, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(false)}} ), _pipe@8 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"false"/utf8>> ), gleeunit_ffi:should_equal( _pipe@8, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(false)}} ), _pipe@9 = glenv@internal@parse:bool(<<"GLENV_TEST_VAR"/utf8>>, <<"0"/utf8>>), gleeunit_ffi:should_equal( _pipe@9, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(false)}} ), _pipe@10 = glenv@internal@parse:bool( <<"GLENV_TEST_VAR"/utf8>>, <<"anythingelse"/utf8>> ), gleeunit_ffi:should_equal( _pipe@10, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(false)}} ). -spec parse_float_test() -> nil. parse_float_test() -> _pipe = glenv@internal@parse:float( <<"GLENV_TEST_VAR"/utf8>>, <<"1.0"/utf8>> ), gleeunit_ffi:should_equal( _pipe, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(1.0)}} ), _pipe@1 = glenv@internal@parse:float( <<"GLENV_TEST_VAR"/utf8>>, <<"1.0001"/utf8>> ), gleeunit_ffi:should_equal( _pipe@1, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(1.0001)}} ), _pipe@2 = glenv@internal@parse:float( <<"GLENV_TEST_VAR"/utf8>>, <<"1.000"/utf8>> ), gleeunit_ffi:should_equal( _pipe@2, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(1.0)}} ), _pipe@3 = glenv@internal@parse:float( <<"GLENV_TEST_VAR"/utf8>>, <<"1"/utf8>> ), gleeunit_ffi:should_be_error(_pipe@3), _pipe@4 = glenv@internal@parse:float( <<"GLENV_TEST_VAR"/utf8>>, <<"abc"/utf8>> ), gleeunit_ffi:should_be_error(_pipe@4). -spec parse_int_test() -> nil. parse_int_test() -> _pipe = glenv@internal@parse:int(<<"GLENV_TEST_VAR"/utf8>>, <<"1"/utf8>>), gleeunit_ffi:should_equal( _pipe, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(1)}} ), _pipe@1 = glenv@internal@parse:int( <<"GLENV_TEST_VAR"/utf8>>, <<"2000000"/utf8>> ), gleeunit_ffi:should_equal( _pipe@1, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(2000000)}} ), _pipe@2 = glenv@internal@parse:int( <<"GLENV_TEST_VAR"/utf8>>, <<"1.0"/utf8>> ), gleeunit_ffi:should_be_error(_pipe@2), _pipe@3 = glenv@internal@parse:int( <<"GLENV_TEST_VAR"/utf8>>, <<"abc"/utf8>> ), gleeunit_ffi:should_be_error(_pipe@3), _pipe@4 = glenv@internal@parse:int( <<"GLENV_TEST_VAR"/utf8>>, <<"2_000"/utf8>> ), gleeunit_ffi:should_be_error(_pipe@4). -spec parse_string_test() -> nil. parse_string_test() -> _pipe = glenv@internal@parse:string(<<"GLENV_TEST_VAR"/utf8>>, <<"1"/utf8>>), gleeunit_ffi:should_equal( _pipe, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(<<"1"/utf8>>)}} ), _pipe@1 = glenv@internal@parse:string( <<"GLENV_TEST_VAR"/utf8>>, <<"2000000"/utf8>> ), gleeunit_ffi:should_equal( _pipe@1, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(<<"2000000"/utf8>>)}} ), _pipe@2 = glenv@internal@parse:string( <<"GLENV_TEST_VAR"/utf8>>, <<"1.0"/utf8>> ), gleeunit_ffi:should_equal( _pipe@2, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(<<"1.0"/utf8>>)}} ), _pipe@3 = glenv@internal@parse:string( <<"GLENV_TEST_VAR"/utf8>>, <<"abc"/utf8>> ), gleeunit_ffi:should_equal( _pipe@3, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(<<"abc"/utf8>>)}} ), _pipe@4 = glenv@internal@parse:string( <<"GLENV_TEST_VAR"/utf8>>, <<"2_000"/utf8>> ), gleeunit_ffi:should_equal( _pipe@4, {ok, {<<"GLENV_TEST_VAR"/utf8>>, gleam@dynamic:from(<<"2_000"/utf8>>)}} ).