feat: updated engine
This commit is contained in:
parent
cbe99774ff
commit
f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* test_fuzzy_search.h */
|
||||
/* test_fuzzy_search.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,11 +28,14 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/string/fuzzy_search.h"
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
TEST_FORCE_LINK(test_fuzzy_search)
|
||||
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/string/fuzzy_search.h"
|
||||
#include "tests/test_utils.h"
|
||||
|
||||
namespace TestFuzzySearch {
|
||||
|
||||
struct FuzzySearchTestCase {
|
||||
|
|
@ -66,15 +69,13 @@ Vector<String> load_test_data() {
|
|||
|
||||
TEST_CASE("[FuzzySearch] Test fuzzy search results") {
|
||||
FuzzySearch search;
|
||||
Vector<FuzzySearchResult> results;
|
||||
Vector<String> targets = load_test_data();
|
||||
|
||||
for (FuzzySearchTestCase test_case : test_cases) {
|
||||
search.set_query(test_case.query);
|
||||
search.search_all(targets, results);
|
||||
Vector<Ref<FuzzySearchMatch>> results = search.search_all(test_case.query, targets);
|
||||
CHECK_GT(results.size(), 0);
|
||||
CHECK_EQ(results[0].target, test_case.expected);
|
||||
CHECK_EQ(results[0]->get_target(), test_case.expected);
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace TestFuzzySearch
|
||||
} // namespace TestFuzzySearch
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* test_node_path.h */
|
||||
/* test_node_path.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,12 +28,12 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
TEST_FORCE_LINK(test_node_path)
|
||||
|
||||
#include "core/string/node_path.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestNodePath {
|
||||
|
||||
TEST_CASE("[NodePath] Relative path") {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* test_string.h */
|
||||
/* test_string.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,12 +28,12 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
TEST_FORCE_LINK(test_string)
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestString {
|
||||
|
||||
int u32scmp(const char32_t *l, const char32_t *r) {
|
||||
|
|
@ -1296,6 +1296,15 @@ TEST_CASE("[String] sprintf") {
|
|||
REQUIRE(error == false);
|
||||
CHECK(output == String("fish 99.990 frog"));
|
||||
|
||||
///// Argument indices.
|
||||
format = "fish %2$d frog %1$s xx";
|
||||
args.clear();
|
||||
args.push_back("test");
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
REQUIRE(error == false);
|
||||
CHECK(output == String("fish 5 frog test xx"));
|
||||
|
||||
///// Errors
|
||||
|
||||
// More formats than arguments.
|
||||
|
|
@ -1622,9 +1631,9 @@ TEST_CASE("[String] Checking string is empty when it should be") {
|
|||
}
|
||||
|
||||
TEST_CASE("[String] lstrip and rstrip") {
|
||||
#define STRIP_TEST(x) \
|
||||
{ \
|
||||
bool success = x; \
|
||||
#define STRIP_TEST(x) \
|
||||
{ \
|
||||
bool success = x; \
|
||||
state = state && success; \
|
||||
}
|
||||
|
||||
|
|
@ -2183,17 +2192,17 @@ TEST_CASE("[String] Variant ptr indexed set") {
|
|||
|
||||
TEST_CASE("[String][URL] Parse URL") {
|
||||
#define CHECK_URL(m_url_to_parse, m_expected_schema, m_expected_host, m_expected_port, m_expected_path, m_expected_fragment, m_expected_error) \
|
||||
if (true) { \
|
||||
int port; \
|
||||
String url(m_url_to_parse), schema, host, path, fragment; \
|
||||
\
|
||||
CHECK_EQ(url.parse_url(schema, host, port, path, fragment), m_expected_error); \
|
||||
CHECK_EQ(schema, m_expected_schema); \
|
||||
CHECK_EQ(host, m_expected_host); \
|
||||
CHECK_EQ(path, m_expected_path); \
|
||||
CHECK_EQ(fragment, m_expected_fragment); \
|
||||
CHECK_EQ(port, m_expected_port); \
|
||||
} else \
|
||||
if (true) { \
|
||||
int port; \
|
||||
String url(m_url_to_parse), schema, host, path, fragment; \
|
||||
\
|
||||
CHECK_EQ(url.parse_url(schema, host, port, path, fragment), m_expected_error); \
|
||||
CHECK_EQ(schema, m_expected_schema); \
|
||||
CHECK_EQ(host, m_expected_host); \
|
||||
CHECK_EQ(path, m_expected_path); \
|
||||
CHECK_EQ(fragment, m_expected_fragment); \
|
||||
CHECK_EQ(port, m_expected_port); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
// All elements.
|
||||
|
|
@ -2235,4 +2244,5 @@ TEST_CASE("[String][URL] Parse URL") {
|
|||
|
||||
#undef CHECK_URL
|
||||
}
|
||||
|
||||
} // namespace TestString
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* test_translation.h */
|
||||
/* test_translation.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,8 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
TEST_FORCE_LINK(test_translation)
|
||||
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/string/optimized_translation.h"
|
||||
#include "core/string/plural_rules.h"
|
||||
#include "core/string/translation.h"
|
||||
|
|
@ -39,7 +42,6 @@
|
|||
#include "editor/import/resource_importer_csv_translation.h"
|
||||
#endif
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
#include "tests/test_utils.h"
|
||||
|
||||
namespace TestTranslation {
|
||||
|
|
@ -260,6 +262,7 @@ TEST_CASE("[TranslationCSV] CSV import") {
|
|||
|
||||
TranslationServer::get_singleton()->remove_domain("godot.test");
|
||||
}
|
||||
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
} // namespace TestTranslation
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* test_translation_server.h */
|
||||
/* test_translation_server.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,13 +28,14 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
TEST_FORCE_LINK(test_translation_server)
|
||||
|
||||
#include "core/string/translation_server.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestTranslationServer {
|
||||
|
||||
TEST_CASE("[TranslationServer] Translation operations") {
|
||||
Ref<TranslationDomain> td = TranslationServer::get_singleton()->get_or_add_domain("godot.test");
|
||||
CHECK(td->get_translations().is_empty());
|
||||
|
|
@ -236,4 +237,5 @@ TEST_CASE("[TranslationServer] Comparing locales") {
|
|||
|
||||
CHECK(res == 10);
|
||||
}
|
||||
|
||||
} // namespace TestTranslationServer
|
||||
Loading…
Add table
Add a link
Reference in a new issue