printf_test.cc 402 字节
Newer Older
Y
Yi Wang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "paddle/string/printf.h"

#include <string>

#include "gtest/gtest.h"

TEST(StringPrintf, StringPrintf) {
  std::string weekday = "Wednesday";
  const char* month = "July";
  size_t day = 27;
  long hour = 14;
  int min = 44;
  EXPECT_EQ(std::string("Wednesday, July 27, 14:44"),
            paddle::string::Sprintf(
                "%s, %s %d, %.2d:%.2d", weekday, month, day, hour, min));
}