gitout

A static git page generator
git clone https://git.bracken.jp/gitout.git
Log | Files | Refs | Submodules | README | LICENSE

utils_test.cc (733B)


      1 extern "C" {
      2 #include "utils.h"
      3 }
      4 
      5 #include <limits.h>
      6 #include <string.h>
      7 
      8 #include "gtest/gtest.h"
      9 
     10 TEST(Utils, CanConcatenatePaths) {
     11   char out[PATH_MAX];
     12   const char* returned = path_concat(out, sizeof(out), "p1", "p2");
     13   EXPECT_EQ(strcmp(out, "p1/p2"), 0);
     14   EXPECT_EQ(strcmp(returned, "p1/p2"), 0);
     15 }
     16 
     17 TEST(Utils, CanConcatenatePathsFirstEmpty) {
     18   char out[PATH_MAX];
     19   const char* returned = path_concat(out, sizeof(out), "", "p2");
     20   EXPECT_EQ(strcmp(out, "p2"), 0);
     21   EXPECT_EQ(strcmp(returned, "p2"), 0);
     22 }
     23 
     24 TEST(Utils, CanConcatenatePathsSecondEmpty) {
     25   char out[PATH_MAX];
     26   const char* returned = path_concat(out, sizeof(out), "p1", "");
     27   EXPECT_EQ(strcmp(out, "p1"), 0);
     28   EXPECT_EQ(strcmp(returned, "p1"), 0);
     29 }