Kajetan Johannes Hammerle vor 5 Tagen
Ursprung
Commit
f259c9e9bc
4 geänderte Dateien mit 17 neuen und 3 gelöschten Zeilen
  1. 0 1
      modules/ToString.cppm
  2. 0 2
      src/ToString.cpp
  3. 10 0
      test.sh
  4. 7 0
      test/modules/UtilityTests.cpp

+ 0 - 1
modules/ToString.cppm

@@ -13,7 +13,6 @@ export namespace Core {
     concept ToString = requires(const T& t, StringBase& b) { t.toString(b); };
 
     class StringBase {
-    public:
         size_t index = 0;
         size_t capacity = 0;
         char* buffer = nullptr;

+ 0 - 2
src/ToString.cpp

@@ -79,7 +79,6 @@ static void parseFormat(
 }
 
 void Core::StringBase::copyFormatUntil(const char*& format, StringFormat& f) {
-    // char* s = getCurrent();
     while(*format != '\0') {
         char u = *(format++);
         if(u == '{') {
@@ -96,7 +95,6 @@ void Core::StringBase::copyFormatUntil(const char*& format, StringFormat& f) {
         }
         index++;
         if(index < capacity) {
-            //*(s++) = u;
             buffer[index - 1] = u;
         }
     }

+ 10 - 0
test.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+clear
+llvm-cov show ./build_debug/test \
+    -instr-profile=build_debug/default.profdata \
+    -show-instantiations=false \
+    -show-instantiation-summary=false \
+    -use-color \
+    -line-coverage-lt=100 \
+    --ignore-filename-regex="test/" \
+    --ignore-filename-regex="src/"

+ 7 - 0
test/modules/UtilityTests.cpp

@@ -145,6 +145,12 @@ static void testStringFormat() {
     Core::testString("", s);
 }
 
+static void testDefaultString() {
+    Core::StringBase s;
+    Core::test(3, s.format("X{}X", 5));
+    Core::test(0, s.getCapacity());
+}
+
 void testUtility() {
     testPopCount();
     testIf();
@@ -155,6 +161,7 @@ void testUtility() {
     testSort();
     testToString();
     testStringFormat();
+    testDefaultString();
 }
 
 static void outOfMemory(void*) {