mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
Merge branch 'master' into feature/network2
This commit is contained in:
4
untests/bin/library/music.json
Normal file
4
untests/bin/library/music.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"sound" : "sound.ogg",
|
||||
"streaming" : true
|
||||
}
|
||||
4
untests/bin/library/sound.json
Normal file
4
untests/bin/library/sound.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"sound" : "sound.ogg",
|
||||
"streaming" : false
|
||||
}
|
||||
3
untests/bin/library/sound.ogg
Executable file
3
untests/bin/library/sound.ogg
Executable file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:910a0ad63ca51685b541e285550c5cc13ff04be2b48a77314d0bf138b044e3d6
|
||||
size 15891
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ namespace
|
||||
modules::initialize<starter>(0, nullptr,
|
||||
starter::parameters(
|
||||
engine::parameters("asset_untests", "enduro2d")
|
||||
.without_audio(true)
|
||||
.without_graphics(true)));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace
|
||||
modules::initialize<starter>(0, nullptr,
|
||||
starter::parameters(
|
||||
engine::parameters("library_untests", "enduro2d")
|
||||
.without_audio(true)
|
||||
.without_graphics(true)));
|
||||
}
|
||||
|
||||
@@ -155,6 +156,20 @@ TEST_CASE("library"){
|
||||
REQUIRE_FALSE(l.cache().find<image_asset>("image.png"));
|
||||
REQUIRE_FALSE(l.cache().find<binary_asset>("image.png"));
|
||||
}
|
||||
{
|
||||
if ( modules::is_initialized<audio>() ) {
|
||||
auto sound_res = l.load_asset<sound_asset>("sound.json");
|
||||
REQUIRE(sound_res);
|
||||
REQUIRE(sound_res->content());
|
||||
|
||||
auto music_res = l.load_asset<sound_asset>("music.json");
|
||||
REQUIRE(music_res);
|
||||
REQUIRE(music_res->content());
|
||||
|
||||
auto fake_sound_res = l.load_asset<sound_asset>("fake_sound.json");
|
||||
REQUIRE_FALSE(fake_sound_res);
|
||||
}
|
||||
}
|
||||
{
|
||||
if ( modules::is_initialized<render>() ) {
|
||||
auto shader_res = l.load_asset<shader_asset>("shader.json");
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace
|
||||
modules::initialize<starter>(0, nullptr,
|
||||
starter::parameters(
|
||||
engine::parameters("world_untests", "enduro2d")
|
||||
.without_audio(true)
|
||||
.without_graphics(true)));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ TEST_CASE("starter"){
|
||||
modules::initialize<starter>(0, nullptr,
|
||||
starter::parameters(
|
||||
engine::parameters("starter_untests", "enduro2d")
|
||||
.without_audio(true)
|
||||
.without_graphics(true)));
|
||||
modules::shutdown<starter>();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace
|
||||
modules::initialize<starter>(0, nullptr,
|
||||
starter::parameters(
|
||||
engine::parameters("world_untests", "enduro2d")
|
||||
.without_audio(true)
|
||||
.without_graphics(true)));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,88 @@ TEST_CASE("strings") {
|
||||
REQUIRE(make_utf32(str16_view(null_utf16, 0)) == make_utf32(u""));
|
||||
REQUIRE(make_utf32(str32_view(null_utf32, 0)) == make_utf32(U""));
|
||||
}
|
||||
{
|
||||
using strings::try_parse;
|
||||
|
||||
{
|
||||
i8 v{111};
|
||||
REQUIRE((try_parse("42", v) && v == 42));
|
||||
REQUIRE((try_parse("+42", v) && v == 42));
|
||||
REQUIRE((try_parse("127", v) && v == 127));
|
||||
REQUIRE((try_parse("0", v) && v == 0));
|
||||
REQUIRE((try_parse("0xF", v) && v == 15));
|
||||
REQUIRE((try_parse("052", v) && v == 42));
|
||||
REQUIRE((try_parse("-052", v) && v == -42));
|
||||
REQUIRE((try_parse("-128", v) && v == -128));
|
||||
|
||||
u8 uv{111};
|
||||
REQUIRE((try_parse("42", uv) && uv == 42));
|
||||
REQUIRE((try_parse("+42", uv) && uv == 42));
|
||||
REQUIRE((try_parse("255", uv) && uv == 255));
|
||||
REQUIRE((try_parse("0xFF", uv) && uv == 255));
|
||||
REQUIRE((try_parse("052", uv) && uv == 42));
|
||||
REQUIRE((try_parse("0", uv) && uv == 0));
|
||||
}
|
||||
{
|
||||
i8 v{111};
|
||||
REQUIRE((!try_parse(str_view(), v) && v == 111));
|
||||
REQUIRE((!try_parse("", v) && v == 111));
|
||||
REQUIRE((!try_parse(" \t", v) && v == 111));
|
||||
REQUIRE((!try_parse("42hello", v) && v == 111));
|
||||
REQUIRE((!try_parse("world42", v) && v == 111));
|
||||
REQUIRE((!try_parse("42 ", v) && v == 111));
|
||||
REQUIRE((!try_parse("-129", v) && v == 111));
|
||||
REQUIRE((!try_parse("128", v) && v == 111));
|
||||
REQUIRE((!try_parse("4.2", v) && v == 111));
|
||||
|
||||
u8 uv{111};
|
||||
REQUIRE((!try_parse(str_view(), uv) && uv == 111));
|
||||
REQUIRE((!try_parse("", uv) && uv == 111));
|
||||
REQUIRE((!try_parse(" \t", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("42hello", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("world42", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("42 ", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("-1", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("256", uv) && uv == 111));
|
||||
REQUIRE((!try_parse("4.2", uv) && uv == 111));
|
||||
}
|
||||
{
|
||||
f32 v32{11.22f};
|
||||
REQUIRE((try_parse("4.23E5", v32) && math::approximately(v32, 4.23e5f)));
|
||||
REQUIRE((try_parse("4.23E-5", v32) && math::approximately(v32, 4.23e-5f)));
|
||||
REQUIRE((try_parse("4.23E+5", v32) && math::approximately(v32, 4.23e+5f)));
|
||||
REQUIRE((try_parse("42", v32) && math::approximately(v32, 42.f)));
|
||||
REQUIRE((try_parse("+42", v32) && math::approximately(v32, 42.f)));
|
||||
REQUIRE((try_parse("-2.43", v32) && math::approximately(v32, -2.43f)));
|
||||
REQUIRE((try_parse("-24", v32) && math::approximately(v32, -24.f)));
|
||||
|
||||
f64 v64{11.22f};
|
||||
REQUIRE((try_parse("4.23E5", v64) && math::approximately(v64, 4.23e5)));
|
||||
REQUIRE((try_parse("4.23E-5", v64) && math::approximately(v64, 4.23e-5)));
|
||||
REQUIRE((try_parse("4.23E+5", v64) && math::approximately(v64, 4.23e+5)));
|
||||
REQUIRE((try_parse("42", v64) && math::approximately(v64, 42.)));
|
||||
REQUIRE((try_parse("+42", v64) && math::approximately(v64, 42.)));
|
||||
REQUIRE((try_parse("-2.43", v64) && math::approximately(v64, -2.43)));
|
||||
REQUIRE((try_parse("-24", v64) && math::approximately(v64, -24.)));
|
||||
}
|
||||
{
|
||||
f32 v32{11.22f};
|
||||
REQUIRE((!try_parse("", v32) && math::approximately(v32, 11.22f)));
|
||||
REQUIRE((!try_parse(" \t", v32) && math::approximately(v32, 11.22f)));
|
||||
REQUIRE((!try_parse("1.0E100", v32) && math::approximately(v32, 11.22f)));
|
||||
REQUIRE((!try_parse("1..4", v32) && math::approximately(v32, 11.22f)));
|
||||
REQUIRE((!try_parse("..14", v32) && math::approximately(v32, 11.22f)));
|
||||
REQUIRE((!try_parse("14..", v32) && math::approximately(v32, 11.22f)));
|
||||
|
||||
f64 v64{11.22};
|
||||
REQUIRE((!try_parse("", v64) && math::approximately(v64, 11.22)));
|
||||
REQUIRE((!try_parse(" \t", v64) && math::approximately(v64, 11.22)));
|
||||
REQUIRE((!try_parse("1.0E400", v64) && math::approximately(v64, 11.22)));
|
||||
REQUIRE((!try_parse("1..4", v64) && math::approximately(v64, 11.22)));
|
||||
REQUIRE((!try_parse("..14", v64) && math::approximately(v64, 11.22)));
|
||||
REQUIRE((!try_parse("14..", v64) && math::approximately(v64, 11.22)));
|
||||
}
|
||||
}
|
||||
{
|
||||
using strings::wildcard_match;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user