[ox] Make ox::String::String(const char*) explicit
This commit is contained in:
parent
e9822bf124
commit
1a1c8ae6cc
18
deps/ox/src/ox/clargs/clargs.cpp
vendored
18
deps/ox/src/ox/clargs/clargs.cpp
vendored
@ -13,7 +13,7 @@ namespace ox {
|
|||||||
|
|
||||||
ClArgs::ClArgs(int argc, const char **args) noexcept {
|
ClArgs::ClArgs(int argc, const char **args) noexcept {
|
||||||
for (auto i = 0u; i < static_cast<unsigned>(argc); ++i) {
|
for (auto i = 0u; i < static_cast<unsigned>(argc); ++i) {
|
||||||
String arg = args[i];
|
auto arg = String(args[i]);
|
||||||
if (arg[0] == '-') {
|
if (arg[0] == '-') {
|
||||||
while (arg[0] == '-' && arg.len()) {
|
while (arg[0] == '-' && arg.len()) {
|
||||||
arg = arg.substr(1);
|
arg = arg.substr(1);
|
||||||
@ -21,7 +21,7 @@ ClArgs::ClArgs(int argc, const char **args) noexcept {
|
|||||||
m_bools[arg] = true;
|
m_bools[arg] = true;
|
||||||
// parse additional arguments
|
// parse additional arguments
|
||||||
if (i < static_cast<unsigned>(argc) && args[i + 1]) {
|
if (i < static_cast<unsigned>(argc) && args[i + 1]) {
|
||||||
String val = args[i + 1];
|
auto val = String(args[i + 1]);
|
||||||
if (val.len() && val[i] != '-') {
|
if (val.len() && val[i] != '-') {
|
||||||
if (val == "false") {
|
if (val == "false") {
|
||||||
m_bools[arg] = false;
|
m_bools[arg] = false;
|
||||||
@ -37,32 +37,32 @@ ClArgs::ClArgs(int argc, const char **args) noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClArgs::getBool(ox::CRString arg, bool defaultValue) const noexcept {
|
bool ClArgs::getBool(ox::CRStringView arg, bool defaultValue) const noexcept {
|
||||||
auto [value, err] = m_ints.at(arg);
|
auto [value, err] = m_ints.at(arg);
|
||||||
return !err ? *value : defaultValue;
|
return !err ? *value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ClArgs::getString(ox::CRString arg, const char *defaultValue) const noexcept {
|
String ClArgs::getString(ox::CRStringView arg, const char *defaultValue) const noexcept {
|
||||||
auto [value, err] = m_strings.at(arg);
|
auto [value, err] = m_strings.at(arg);
|
||||||
return !err ? *value : defaultValue;
|
return !err ? *value : ox::String(defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClArgs::getInt(ox::CRString arg, int defaultValue) const noexcept {
|
int ClArgs::getInt(ox::CRStringView arg, int defaultValue) const noexcept {
|
||||||
auto [value, err] = m_ints.at(arg);
|
auto [value, err] = m_ints.at(arg);
|
||||||
return !err ? *value : defaultValue;
|
return !err ? *value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> ClArgs::getBool(ox::CRString arg) const noexcept {
|
Result<bool> ClArgs::getBool(ox::CRStringView arg) const noexcept {
|
||||||
oxRequire(out, m_bools.at(arg));
|
oxRequire(out, m_bools.at(arg));
|
||||||
return *out;
|
return *out;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<String> ClArgs::getString(ox::CRString argName) const noexcept {
|
Result<String> ClArgs::getString(ox::CRStringView argName) const noexcept {
|
||||||
oxRequire(out, m_strings.at(argName));
|
oxRequire(out, m_strings.at(argName));
|
||||||
return *out;
|
return *out;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> ClArgs::getInt(ox::CRString arg) const noexcept {
|
Result<int> ClArgs::getInt(ox::CRStringView arg) const noexcept {
|
||||||
oxRequire(out, m_ints.at(arg));
|
oxRequire(out, m_ints.at(arg));
|
||||||
return *out;
|
return *out;
|
||||||
}
|
}
|
||||||
|
12
deps/ox/src/ox/clargs/clargs.hpp
vendored
12
deps/ox/src/ox/clargs/clargs.hpp
vendored
@ -23,21 +23,21 @@ class ClArgs {
|
|||||||
ClArgs(int argc, const char **args) noexcept;
|
ClArgs(int argc, const char **args) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
bool getBool(ox::CRString arg, bool defaultValue) const noexcept;
|
bool getBool(ox::CRStringView arg, bool defaultValue) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
String getString(ox::CRString argName, const char *defaultValue) const noexcept;
|
String getString(ox::CRStringView argName, const char *defaultValue) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
int getInt(ox::CRString arg, int defaultValue) const noexcept;
|
int getInt(ox::CRStringView arg, int defaultValue) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
Result<bool> getBool(ox::CRString arg) const noexcept;
|
Result<bool> getBool(ox::CRStringView arg) const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
Result<String> getString(ox::CRString argName) const noexcept;
|
Result<String> getString(ox::CRStringView argName) const noexcept;
|
||||||
|
|
||||||
Result<int> getInt(ox::CRString arg) const noexcept;
|
Result<int> getInt(ox::CRStringView arg) const noexcept;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/claw/test/tests.cpp
vendored
4
deps/ox/src/ox/claw/test/tests.cpp
vendored
@ -112,7 +112,7 @@ static std::map<std::string_view, ox::Error(*)()> tests = {
|
|||||||
{
|
{
|
||||||
"ClawHeaderReader",
|
"ClawHeaderReader",
|
||||||
[] {
|
[] {
|
||||||
ox::String hdr = "O1;com.drinkingtea.ox.claw.test.Header;2;";
|
ox::String hdr("O1;com.drinkingtea.ox.claw.test.Header;2;");
|
||||||
auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1);
|
auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1);
|
||||||
oxAssert(err, "Error parsing header");
|
oxAssert(err, "Error parsing header");
|
||||||
oxAssert(ch.fmt == ox::ClawFormat::Organic, "Format wrong");
|
oxAssert(ch.fmt == ox::ClawFormat::Organic, "Format wrong");
|
||||||
@ -124,7 +124,7 @@ static std::map<std::string_view, ox::Error(*)()> tests = {
|
|||||||
{
|
{
|
||||||
"ClawHeaderReader2",
|
"ClawHeaderReader2",
|
||||||
[] {
|
[] {
|
||||||
ox::String hdr = "M2;com.drinkingtea.ox.claw.test.Header2;3;";
|
ox::String hdr("M2;com.drinkingtea.ox.claw.test.Header2;3;");
|
||||||
auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1);
|
auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1);
|
||||||
oxAssert(err, "Error parsing header");
|
oxAssert(err, "Error parsing header");
|
||||||
oxAssert(ch.fmt == ox::ClawFormat::Metal, "Format wrong");
|
oxAssert(ch.fmt == ox::ClawFormat::Metal, "Format wrong");
|
||||||
|
@ -24,7 +24,7 @@ PassThroughFS::PassThroughFS(CRStringView dirPath) {
|
|||||||
PassThroughFS::~PassThroughFS() noexcept = default;
|
PassThroughFS::~PassThroughFS() noexcept = default;
|
||||||
|
|
||||||
String PassThroughFS::basePath() const noexcept {
|
String PassThroughFS::basePath() const noexcept {
|
||||||
return m_path.string().c_str();
|
return ox::String(m_path.string().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept {
|
Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept {
|
||||||
|
14
deps/ox/src/ox/fs/test/tests.cpp
vendored
14
deps/ox/src/ox/fs/test/tests.cpp
vendored
@ -58,7 +58,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::next1",
|
"PathIterator::next1",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "/usr/share/charset.gbag";
|
auto const path = ox::String("/usr/share/charset.gbag");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
||||||
@ -70,7 +70,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::next2",
|
"PathIterator::next2",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "/usr/share/";
|
auto const path = ox::String("/usr/share/");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
||||||
@ -81,7 +81,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::next3",
|
"PathIterator::next3",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "/";
|
auto const path = ox::String("/");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "\0") == 0, "PathIterator shows wrong next");
|
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "\0") == 0, "PathIterator shows wrong next");
|
||||||
@ -91,7 +91,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::next4",
|
"PathIterator::next4",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "usr/share/charset.gbag";
|
auto const path = ox::String("usr/share/charset.gbag");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
||||||
@ -103,7 +103,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::next5",
|
"PathIterator::next5",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "usr/share/";
|
auto const path = ox::String("usr/share/");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next");
|
||||||
@ -114,7 +114,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::dirPath",
|
"PathIterator::dirPath",
|
||||||
[] (std::string_view) {
|
[] (std::string_view) {
|
||||||
ox::String path = "/usr/share/charset.gbag";
|
auto const path = ox::String("/usr/share/charset.gbag");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.dirPath(buff, path.len()) == 0 && ox_strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path");
|
oxAssert(it.dirPath(buff, path.len()) == 0 && ox_strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path");
|
||||||
@ -124,7 +124,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> tes
|
|||||||
{
|
{
|
||||||
"PathIterator::fileName",
|
"PathIterator::fileName",
|
||||||
[](std::string_view) {
|
[](std::string_view) {
|
||||||
ox::String path = "/usr/share/charset.gbag";
|
auto const path = ox::String("/usr/share/charset.gbag");
|
||||||
ox::PathIterator it(path.c_str(), path.len());
|
ox::PathIterator it(path.c_str(), path.len());
|
||||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||||
oxAssert(it.fileName(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name");
|
oxAssert(it.fileName(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name");
|
||||||
|
2
deps/ox/src/ox/fs/tool.cpp
vendored
2
deps/ox/src/ox/fs/tool.cpp
vendored
@ -67,7 +67,7 @@ static ox::Error run(int argc, const char **argv) noexcept {
|
|||||||
return OxError(1);
|
return OxError(1);
|
||||||
}
|
}
|
||||||
const auto fsPath = argv[1];
|
const auto fsPath = argv[1];
|
||||||
ox::String subCmd = argv[2];
|
ox::String subCmd(argv[2]);
|
||||||
oxRequire(fs, loadFs(fsPath));
|
oxRequire(fs, loadFs(fsPath));
|
||||||
if (subCmd == "ls") {
|
if (subCmd == "ls") {
|
||||||
return runLs(fs.get(), argc - 2, argv + 2);
|
return runLs(fs.get(), argc - 2, argv + 2);
|
||||||
|
16
deps/ox/src/ox/mc/test/tests.cpp
vendored
16
deps/ox/src/ox/mc/test/tests.cpp
vendored
@ -45,7 +45,7 @@ struct TestStruct {
|
|||||||
int32_t Int8 = 0;
|
int32_t Int8 = 0;
|
||||||
int unionIdx = 1;
|
int unionIdx = 1;
|
||||||
TestUnion Union;
|
TestUnion Union;
|
||||||
ox::String String = "";
|
ox::String String;
|
||||||
ox::BString<32> BString = "";
|
ox::BString<32> BString = "";
|
||||||
uint32_t List[4] = {0, 0, 0, 0};
|
uint32_t List[4] = {0, 0, 0, 0};
|
||||||
ox::Vector<uint32_t> Vector = {1, 2, 3, 4, 5};
|
ox::Vector<uint32_t> Vector = {1, 2, 3, 4, 5};
|
||||||
@ -108,7 +108,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith<TestStruct> auto *obj) noexce
|
|||||||
std::map<ox::String, ox::Error(*)()> tests = {
|
std::map<ox::String, ox::Error(*)()> tests = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"MetalClawWriter",
|
ox::String("MetalClawWriter"),
|
||||||
[] {
|
[] {
|
||||||
// This test doesn't confirm much, but it does show that the writer
|
// This test doesn't confirm much, but it does show that the writer
|
||||||
// doesn't segfault
|
// doesn't segfault
|
||||||
@ -121,7 +121,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"MetalClawReader",
|
ox::String("MetalClawReader"),
|
||||||
[] {
|
[] {
|
||||||
// setup for tests
|
// setup for tests
|
||||||
TestStruct testIn, testOut;
|
TestStruct testIn, testOut;
|
||||||
@ -180,7 +180,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"encodeInteger",
|
ox::String("encodeInteger"),
|
||||||
[] {
|
[] {
|
||||||
using ox::MaxValue;
|
using ox::MaxValue;
|
||||||
using ox::mc::McInt;
|
using ox::mc::McInt;
|
||||||
@ -251,7 +251,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"decodeInteger",
|
ox::String("decodeInteger"),
|
||||||
[] {
|
[] {
|
||||||
using ox::MaxValue;
|
using ox::MaxValue;
|
||||||
using ox::mc::McInt;
|
using ox::mc::McInt;
|
||||||
@ -293,7 +293,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"MetalClawModelValue",
|
ox::String("MetalClawModelValue"),
|
||||||
[] {
|
[] {
|
||||||
static constexpr size_t dataBuffLen = ox::units::MB;
|
static constexpr size_t dataBuffLen = ox::units::MB;
|
||||||
ox::Buffer dataBuff(dataBuffLen);
|
ox::Buffer dataBuff(dataBuffLen);
|
||||||
@ -345,7 +345,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"MetalClawDef",
|
ox::String("MetalClawDef"),
|
||||||
[] {
|
[] {
|
||||||
//constexpr size_t descBuffLen = 1024;
|
//constexpr size_t descBuffLen = 1024;
|
||||||
//uint8_t descBuff[descBuffLen];
|
//uint8_t descBuff[descBuffLen];
|
||||||
@ -461,7 +461,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
|
|
||||||
int main(int argc, const char **args) {
|
int main(int argc, const char **args) {
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
auto testName = args[1];
|
auto testName = ox::String(args[1]);
|
||||||
if (tests.find(testName) != tests.end()) {
|
if (tests.find(testName) != tests.end()) {
|
||||||
oxAssert(tests[testName](), "Test failed...");
|
oxAssert(tests[testName](), "Test failed...");
|
||||||
}
|
}
|
||||||
|
8
deps/ox/src/ox/model/modelvalue.hpp
vendored
8
deps/ox/src/ox/model/modelvalue.hpp
vendored
@ -450,7 +450,7 @@ class ModelObject {
|
|||||||
f = val;
|
f = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Result<const ModelValue*> get(const String &k) const noexcept {
|
constexpr Result<const ModelValue*> get(StringView const&k) const noexcept {
|
||||||
if (m_fields.contains(k)) {
|
if (m_fields.contains(k)) {
|
||||||
return *m_fields.at(k).value;
|
return *m_fields.at(k).value;
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ class ModelObject {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr auto &operator[](const String &k) noexcept {
|
constexpr auto &operator[](StringView const&k) noexcept {
|
||||||
auto [v, err] = m_fields.at(k);
|
auto [v, err] = m_fields.at(k);
|
||||||
if (err) [[unlikely]] {
|
if (err) [[unlikely]] {
|
||||||
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
||||||
@ -553,7 +553,7 @@ class ModelUnion {
|
|||||||
return UniquePtr<ModelUnion>(new ModelUnion(other));
|
return UniquePtr<ModelUnion>(new ModelUnion(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr auto &operator[](const String &k) noexcept {
|
constexpr auto &operator[](StringView const&k) noexcept {
|
||||||
const auto [v, err] = m_fields.at(k);
|
const auto [v, err] = m_fields.at(k);
|
||||||
if (err) [[unlikely]] {
|
if (err) [[unlikely]] {
|
||||||
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
||||||
@ -588,7 +588,7 @@ class ModelUnion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Result<const ModelValue*> get(const String &k) const noexcept {
|
constexpr Result<const ModelValue*> get(StringView const&k) const noexcept {
|
||||||
oxRequire(t, m_fields.at(k));
|
oxRequire(t, m_fields.at(k));
|
||||||
return &(*t)->value;
|
return &(*t)->value;
|
||||||
}
|
}
|
||||||
|
8
deps/ox/src/ox/model/test/tests.cpp
vendored
8
deps/ox/src/ox/model/test/tests.cpp
vendored
@ -35,7 +35,7 @@ constexpr auto getModelTypeVersion(TestType2*) noexcept {
|
|||||||
std::map<ox::String, ox::Error(*)()> tests = {
|
std::map<ox::String, ox::Error(*)()> tests = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"ModelValue",
|
ox::String("ModelValue"),
|
||||||
[] {
|
[] {
|
||||||
ox::ModelValue v;
|
ox::ModelValue v;
|
||||||
oxReturnError(v.setType<int32_t>());
|
oxReturnError(v.setType<int32_t>());
|
||||||
@ -48,7 +48,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"getModelTypeName",
|
ox::String("getModelTypeName"),
|
||||||
[] {
|
[] {
|
||||||
oxAssert(ox::getModelTypeName<TestType>() == TestType::TypeName, "getModelTypeName call failed");
|
oxAssert(ox::getModelTypeName<TestType>() == TestType::TypeName, "getModelTypeName call failed");
|
||||||
oxAssert(ox::getModelTypeName<TestType2>() == ox::StringView("net.drinkingtea.model.test.TestType2"), "getModelTypeName call failed");
|
oxAssert(ox::getModelTypeName<TestType2>() == ox::StringView("net.drinkingtea.model.test.TestType2"), "getModelTypeName call failed");
|
||||||
@ -56,7 +56,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"getModelTypeVersion",
|
ox::String("getModelTypeVersion"),
|
||||||
[] {
|
[] {
|
||||||
oxAssert(ox::getModelTypeVersion<TestType>() == TestType::TypeVersion, "getModelTypeVersion call failed");
|
oxAssert(ox::getModelTypeVersion<TestType>() == TestType::TypeVersion, "getModelTypeVersion call failed");
|
||||||
oxAssert(ox::getModelTypeVersion<TestType2>() == 2, "getModelTypeVersion call failed");
|
oxAssert(ox::getModelTypeVersion<TestType2>() == 2, "getModelTypeVersion call failed");
|
||||||
@ -68,7 +68,7 @@ std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
|
|
||||||
int main(int argc, const char **args) {
|
int main(int argc, const char **args) {
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
auto testName = args[1];
|
auto testName = ox::String(args[1]);
|
||||||
if (tests.find(testName) != tests.end()) {
|
if (tests.find(testName) != tests.end()) {
|
||||||
oxAssert(tests[testName](), "Test failed...");
|
oxAssert(tests[testName](), "Test failed...");
|
||||||
}
|
}
|
||||||
|
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
@ -53,7 +53,7 @@ struct TestStruct {
|
|||||||
int32_t Int8 = 0;
|
int32_t Int8 = 0;
|
||||||
int unionIdx = 1;
|
int unionIdx = 1;
|
||||||
TestUnion Union;
|
TestUnion Union;
|
||||||
ox::String String = "";
|
ox::String String{""};
|
||||||
uint32_t List[4] = {0, 0, 0, 0};
|
uint32_t List[4] = {0, 0, 0, 0};
|
||||||
ox::HashMap<ox::String, int> Map;
|
ox::HashMap<ox::String, int> Map;
|
||||||
TestStructNest EmptyStruct;
|
TestStructNest EmptyStruct;
|
||||||
|
62
deps/ox/src/ox/std/string.hpp
vendored
62
deps/ox/src/ox/std/string.hpp
vendored
@ -32,15 +32,15 @@ class BasicString {
|
|||||||
|
|
||||||
constexpr explicit BasicString(std::size_t cap) noexcept;
|
constexpr explicit BasicString(std::size_t cap) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(const char *str) noexcept;
|
constexpr explicit BasicString(const char *str) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(const char8_t *str) noexcept;
|
constexpr explicit BasicString(const char8_t *str) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(const char *str, std::size_t size) noexcept;
|
constexpr BasicString(const char *str, std::size_t size) noexcept;
|
||||||
|
|
||||||
constexpr explicit BasicString(CRStringView str) noexcept;
|
constexpr explicit BasicString(CRStringView str) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(const BasicString&) noexcept;
|
constexpr BasicString(BasicString const&) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(BasicString&&) noexcept;
|
constexpr BasicString(BasicString&&) noexcept;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class BasicString {
|
|||||||
|
|
||||||
constexpr BasicString &operator+=(StringView src) noexcept;
|
constexpr BasicString &operator+=(StringView src) noexcept;
|
||||||
|
|
||||||
constexpr BasicString &operator+=(const BasicString &src) noexcept;
|
constexpr BasicString &operator+=(BasicString const&src) noexcept;
|
||||||
|
|
||||||
constexpr BasicString operator+(const char *str) const noexcept;
|
constexpr BasicString operator+(const char *str) const noexcept;
|
||||||
|
|
||||||
@ -142,23 +142,23 @@ class BasicString {
|
|||||||
|
|
||||||
constexpr BasicString operator+(CRStringView src) const noexcept;
|
constexpr BasicString operator+(CRStringView src) const noexcept;
|
||||||
|
|
||||||
constexpr BasicString operator+(const BasicString &src) const noexcept;
|
constexpr BasicString operator+(BasicString const&src) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator==(const char *other) const noexcept;
|
constexpr bool operator==(const char *other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator==(const OxString_c auto &other) const noexcept;
|
constexpr bool operator==(OxString_c auto const&other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator!=(const char *other) const noexcept;
|
constexpr bool operator!=(const char *other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator!=(const OxString_c auto &other) const noexcept;
|
constexpr bool operator!=(OxString_c auto const&other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator<(const BasicString &other) const noexcept;
|
constexpr bool operator<(BasicString const&other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator>(const BasicString &other) const noexcept;
|
constexpr bool operator>(BasicString const&other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator<=(const BasicString &other) const noexcept;
|
constexpr bool operator<=(BasicString const&other) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator>=(const BasicString &other) const noexcept;
|
constexpr bool operator>=(BasicString const&other) const noexcept;
|
||||||
|
|
||||||
constexpr char operator[](std::size_t i) const noexcept;
|
constexpr char operator[](std::size_t i) const noexcept;
|
||||||
|
|
||||||
@ -225,13 +225,8 @@ class BasicString {
|
|||||||
constexpr std::size_t bytes() const noexcept;
|
constexpr std::size_t bytes() const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<std::size_t OtherSize>
|
|
||||||
constexpr void set(const BasicString<OtherSize> &src) noexcept;
|
|
||||||
|
|
||||||
constexpr void set(CRStringView str) noexcept;
|
constexpr void set(CRStringView str) noexcept;
|
||||||
|
|
||||||
constexpr void set(const char *str) noexcept;
|
|
||||||
|
|
||||||
constexpr void set(const char8_t *str) noexcept;
|
constexpr void set(const char8_t *str) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -388,7 +383,7 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(const BasicString &src) noexcept {
|
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(BasicString const&src) noexcept {
|
||||||
oxIgnoreError(append(src.c_str(), src.len()));
|
oxIgnoreError(append(src.c_str(), src.len()));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -436,7 +431,7 @@ constexpr BasicString<SmallStringSize_v> BasicString<SmallStringSize_v>::operato
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr BasicString<SmallStringSize_v> BasicString<SmallStringSize_v>::operator+(const BasicString &src) const noexcept {
|
constexpr BasicString<SmallStringSize_v> BasicString<SmallStringSize_v>::operator+(BasicString const&src) const noexcept {
|
||||||
const std::size_t strLen = src.len();
|
const std::size_t strLen = src.len();
|
||||||
const auto currentLen = len();
|
const auto currentLen = len();
|
||||||
BasicString<SmallStringSize_v> cpy(currentLen + strLen);
|
BasicString<SmallStringSize_v> cpy(currentLen + strLen);
|
||||||
@ -459,7 +454,7 @@ constexpr bool BasicString<SmallStringSize_v>::operator==(const char *other) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator==(const OxString_c auto &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator==(OxString_c auto const&other) const noexcept {
|
||||||
return ox::StringView(*this) == ox::StringView(other);
|
return ox::StringView(*this) == ox::StringView(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,27 +464,27 @@ constexpr bool BasicString<SmallStringSize_v>::operator!=(const char *other) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator!=(const OxString_c auto &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator!=(OxString_c auto const&other) const noexcept {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator<(const BasicString &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator<(BasicString const&other) const noexcept {
|
||||||
return ox_strcmp(c_str(), other.c_str()) < 0;
|
return ox_strcmp(c_str(), other.c_str()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator>(const BasicString &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator>(BasicString const&other) const noexcept {
|
||||||
return ox_strcmp(c_str(), other.c_str()) > 0;
|
return ox_strcmp(c_str(), other.c_str()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator<=(const BasicString &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator<=(BasicString const&other) const noexcept {
|
||||||
return ox_strcmp(c_str(), other.c_str()) < 1;
|
return ox_strcmp(c_str(), other.c_str()) < 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr bool BasicString<SmallStringSize_v>::operator>=(const BasicString &other) const noexcept {
|
constexpr bool BasicString<SmallStringSize_v>::operator>=(BasicString const&other) const noexcept {
|
||||||
return ox_strcmp(c_str(), other.c_str()) > -1;
|
return ox_strcmp(c_str(), other.c_str()) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,31 +538,14 @@ constexpr std::size_t BasicString<SmallStringSize_v>::len() const noexcept {
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
|
||||||
template<std::size_t OtherSize>
|
|
||||||
constexpr void BasicString<SmallStringSize_v>::set(const BasicString<OtherSize> &src) noexcept {
|
|
||||||
std::size_t strBytes = src.bytes();
|
|
||||||
m_buff.resize(strBytes);
|
|
||||||
copy_n(src.begin(), strBytes, m_buff.data());
|
|
||||||
*m_buff.back().value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr void BasicString<SmallStringSize_v>::set(CRStringView str) noexcept {
|
constexpr void BasicString<SmallStringSize_v>::set(CRStringView str) noexcept {
|
||||||
std::size_t strBytes = str.bytes();
|
std::size_t const strBytes = str.bytes();
|
||||||
m_buff.resize(strBytes + 1);
|
m_buff.resize(strBytes + 1);
|
||||||
copy_n(str.data(), strBytes, m_buff.data());
|
copy_n(str.data(), strBytes, m_buff.data());
|
||||||
*m_buff.back().value = 0;
|
*m_buff.back().value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
|
||||||
constexpr void BasicString<SmallStringSize_v>::set(const char *str) noexcept {
|
|
||||||
std::size_t strBytes = ox_strlen(str) + 1;
|
|
||||||
m_buff.resize(strBytes);
|
|
||||||
copy_n(str, strBytes, m_buff.data());
|
|
||||||
*m_buff.back().value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr void BasicString<SmallStringSize_v>::set(const char8_t *str) noexcept {
|
constexpr void BasicString<SmallStringSize_v>::set(const char8_t *str) noexcept {
|
||||||
std::size_t strBytes = ox_strlen(str) + 1;
|
std::size_t strBytes = ox_strlen(str) + 1;
|
||||||
|
36
deps/ox/src/ox/std/test/tests.cpp
vendored
36
deps/ox/src/ox/std/test/tests.cpp
vendored
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
static std::map<ox::String, ox::Error(*)()> tests = {
|
static std::map<ox::String, ox::Error(*)()> tests = {
|
||||||
{
|
{
|
||||||
"malloc",
|
ox::String("malloc"),
|
||||||
[] {
|
[] {
|
||||||
ox::Buffer buff(ox::units::MB);
|
ox::Buffer buff(ox::units::MB);
|
||||||
ox::heapmgr::initHeap(&buff[0], &buff[buff.size()-1]);
|
ox::heapmgr::initHeap(&buff[0], &buff[buff.size()-1]);
|
||||||
@ -26,7 +26,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itoa",
|
ox::String("itoa"),
|
||||||
[]() {
|
[]() {
|
||||||
ox::Array<char, 10> buff;
|
ox::Array<char, 10> buff;
|
||||||
ox::CharBuffWriter bw(buff);
|
ox::CharBuffWriter bw(buff);
|
||||||
@ -42,31 +42,31 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ABCDEFG != HIJKLMN",
|
ox::String("ABCDEFG != HIJKLMN"),
|
||||||
[]() {
|
[]() {
|
||||||
return OxError(ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0);
|
return OxError(ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"HIJKLMN != ABCDEFG",
|
ox::String("HIJKLMN != ABCDEFG"),
|
||||||
[]() {
|
[]() {
|
||||||
return OxError(ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0);
|
return OxError(ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ABCDEFG == ABCDEFG",
|
ox::String("ABCDEFG == ABCDEFG"),
|
||||||
[]() {
|
[]() {
|
||||||
return OxError(ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0);
|
return OxError(ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ABCDEFGHI == ABCDEFG",
|
ox::String("ABCDEFGHI == ABCDEFG"),
|
||||||
[]() {
|
[]() {
|
||||||
return OxError(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0);
|
return OxError(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"BString",
|
ox::String("BString"),
|
||||||
[]() {
|
[]() {
|
||||||
ox::BString<5> s;
|
ox::BString<5> s;
|
||||||
s += "A";
|
s += "A";
|
||||||
@ -82,7 +82,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"String",
|
ox::String("String"),
|
||||||
[]() {
|
[]() {
|
||||||
ox::String s;
|
ox::String s;
|
||||||
s += "A";
|
s += "A";
|
||||||
@ -113,7 +113,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Vector",
|
ox::String("Vector"),
|
||||||
[] {
|
[] {
|
||||||
ox::Vector<int> v;
|
ox::Vector<int> v;
|
||||||
oxAssert(v.size() == 0, "Initial Vector size not 0");
|
oxAssert(v.size() == 0, "Initial Vector size not 0");
|
||||||
@ -130,7 +130,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"HashMap",
|
ox::String("HashMap"),
|
||||||
[] {
|
[] {
|
||||||
ox::HashMap<const char*, int> si;
|
ox::HashMap<const char*, int> si;
|
||||||
si["asdf"] = 42;
|
si["asdf"] = 42;
|
||||||
@ -146,7 +146,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Serialize-Int",
|
ox::String("Serialize-Int"),
|
||||||
[] {
|
[] {
|
||||||
using BA = ox::Array<char, 4>;
|
using BA = ox::Array<char, 4>;
|
||||||
const auto actual = ox::serialize<uint32_t>(256).unwrap();
|
const auto actual = ox::serialize<uint32_t>(256).unwrap();
|
||||||
@ -163,7 +163,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"BufferWriter",
|
ox::String("BufferWriter"),
|
||||||
[] {
|
[] {
|
||||||
ox::Buffer b;
|
ox::Buffer b;
|
||||||
ox::BufferWriter w(&b);
|
ox::BufferWriter w(&b);
|
||||||
@ -180,7 +180,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"FromHex",
|
ox::String("FromHex"),
|
||||||
[] {
|
[] {
|
||||||
oxExpect(ox::detail::fromHex("01").unwrap(), 0x01);
|
oxExpect(ox::detail::fromHex("01").unwrap(), 0x01);
|
||||||
oxExpect(ox::detail::fromHex("02").unwrap(), 0x02);
|
oxExpect(ox::detail::fromHex("02").unwrap(), 0x02);
|
||||||
@ -203,7 +203,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToHex",
|
ox::String("ToHex"),
|
||||||
[] {
|
[] {
|
||||||
oxExpect(ox::detail::toHex(0x01), "01");
|
oxExpect(ox::detail::toHex(0x01), "01");
|
||||||
oxExpect(ox::detail::toHex(0x02), "02");
|
oxExpect(ox::detail::toHex(0x02), "02");
|
||||||
@ -223,7 +223,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"UUID",
|
ox::String("UUID"),
|
||||||
[] {
|
[] {
|
||||||
constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db";
|
constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db";
|
||||||
oxRequire(uuid, ox::UUID::fromString(uuidStr));
|
oxRequire(uuid, ox::UUID::fromString(uuidStr));
|
||||||
@ -234,7 +234,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"UUID::generate",
|
ox::String("UUID::generate"),
|
||||||
[] {
|
[] {
|
||||||
ox::UUID::seedGenerator({1234, 4321});
|
ox::UUID::seedGenerator({1234, 4321});
|
||||||
oxExpect(ox::UUID::generate().unwrap().toString(), "5c3f4b5e-ccbf-4727-7f03-3053dedc8827");
|
oxExpect(ox::UUID::generate().unwrap().toString(), "5c3f4b5e-ccbf-4727-7f03-3053dedc8827");
|
||||||
@ -244,7 +244,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"StringSplit",
|
ox::String("StringSplit"),
|
||||||
[] {
|
[] {
|
||||||
ox::StringView sv = "ab.cd";
|
ox::StringView sv = "ab.cd";
|
||||||
auto list = ox::split(sv, ".");
|
auto list = ox::split(sv, ".");
|
||||||
@ -314,7 +314,7 @@ static std::map<ox::String, ox::Error(*)()> tests = {
|
|||||||
|
|
||||||
int main(int argc, const char **args) {
|
int main(int argc, const char **args) {
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
auto testName = args[1];
|
auto testName = ox::String(args[1]);
|
||||||
if (tests.find(testName) != tests.end()) {
|
if (tests.find(testName) != tests.end()) {
|
||||||
oxAssert(tests[testName](), "Test returned Error");
|
oxAssert(tests[testName](), "Test returned Error");
|
||||||
return 0;
|
return 0;
|
||||||
|
4
deps/ox/src/ox/std/trace.hpp
vendored
4
deps/ox/src/ox/std/trace.hpp
vendored
@ -39,10 +39,10 @@ enum class MsgId: char {
|
|||||||
struct TraceMsgRcv {
|
struct TraceMsgRcv {
|
||||||
static constexpr auto TypeName = "net.drinkingtea.ox.trace.TraceMsg";
|
static constexpr auto TypeName = "net.drinkingtea.ox.trace.TraceMsg";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
BasicString<50> file = "";
|
BasicString<50> file{""};
|
||||||
int line = 0;
|
int line = 0;
|
||||||
uint64_t time = 0;
|
uint64_t time = 0;
|
||||||
BasicString<50> ch = "";
|
BasicString<50> ch{""};
|
||||||
BasicString<100> msg;
|
BasicString<100> msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user