test-format.cpp 331 B

1234567891011121314
  1. #include "testlib.h"
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4. registerGen(argc, argv, 1);
  5. println(format("%d", 42));
  6. println(format("hello, %s!", "hat"));
  7. println(format("%s%d!", "'hat'", 42));
  8. println(format("%s%d!", "'%s'", 42));
  9. ensure(format("%f", 42.5).substr(0, 4) == "42.5");
  10. }