Added tests file for Utils.hpp, fixed OctToInt and Split functions
This commit is contained in:
@@ -127,7 +127,7 @@ namespace OpenVulkano
|
||||
static constexpr int64_t OctToInt(std::string_view string)
|
||||
{
|
||||
int64_t result = 0;
|
||||
for(int i = static_cast<int>(string.length()) - 1; i >= 0; i--)
|
||||
for(int i = 0; i < static_cast<int>(string.length()); i++)
|
||||
{
|
||||
char c = string[i];
|
||||
if (c == 0) break;
|
||||
@@ -168,18 +168,21 @@ namespace OpenVulkano
|
||||
{
|
||||
std::vector<std::string> subs;
|
||||
size_t startPos = 0, pos;
|
||||
|
||||
while ((pos = str.find(separator, startPos)) != std::string::npos)
|
||||
{
|
||||
if (startPos == pos)
|
||||
if (pos != startPos)
|
||||
{
|
||||
startPos++;
|
||||
continue;
|
||||
subs.emplace_back(str.substr(startPos, pos - startPos));
|
||||
}
|
||||
subs.emplace_back(str.substr(startPos, pos - startPos));
|
||||
startPos = pos + 1;
|
||||
}
|
||||
if (startPos != str.length() - 1)
|
||||
|
||||
if (startPos < str.size())
|
||||
{
|
||||
subs.emplace_back(str.substr(startPos));
|
||||
}
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user