From fab2c36313ad7e2af8e497473dce35fb00486a99 Mon Sep 17 00:00:00 2001 From: furudbat Date: Sat, 2 Mar 2024 11:51:15 +0100 Subject: [PATCH] Add tests for FileText and FileData --- tests/raylib_cpp_test.cpp | 13 +++++++++++++ tests/resources/lorem.txt | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 tests/resources/lorem.txt diff --git a/tests/raylib_cpp_test.cpp b/tests/raylib_cpp_test.cpp index 375eff4..58c358f 100644 --- a/tests/raylib_cpp_test.cpp +++ b/tests/raylib_cpp_test.cpp @@ -127,6 +127,19 @@ int main(int argc, char *argv[]) { Assert(passed, "Expected to have a RaylibException to be thrown"); } + // Load FileData + { + raylib::FileData file(path + "/resources/weird.wav"); + Assert(file.GetBytesRead() > 0, "Expected file to be loaded correctly"); + } + + // Load FileText + { + raylib::FileText text(path + "/resources/lorem.txt"); + Assert(text.GetLength() > 0, "Expected file to be loaded correctly"); + AssertEqual(text.ToString().substr(0, 5), "Lorem"); + } + TraceLog(LOG_INFO, "TEST: raylib-cpp test"); TraceLog(LOG_INFO, "---------------------"); return 0; diff --git a/tests/resources/lorem.txt b/tests/resources/lorem.txt new file mode 100644 index 0000000..4c738ee --- /dev/null +++ b/tests/resources/lorem.txt @@ -0,0 +1,4 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file