ysaie

31 / ⚧ / code, music, art, games

──────────────────────────────
🌸 many-shaped creature
✨ too many projects
🚀 cannot be stopped
🌙 stayed up too late
:eggbug: eggbug enjoyer
──────────────────────────────
header image: chapter 8 complete from celeste
avatar: made using this character builder


📩 email
contact@echowritescode.dev

(a) yes, i know std::format() exists
(b) and yet, my power grows...


(i wrote a format() function that checks the format string at compile time)
(i'm gonna build all sorts of infrastructure on top of this)
(i'm excited)

CRUCIBLE_TEST_SCENARIO(format_bool)
{
  {
    auto const result { format("{}", true) };
    CRUCIBLE_CORE_ASSERT_EQ(result.size(), 4);
    CRUCIBLE_CORE_ASSERT_EQ(result, "true");
  }

  {
    auto const result { format("{}", false) };
    CRUCIBLE_CORE_ASSERT_EQ(result.size(), 5);
    CRUCIBLE_CORE_ASSERT_EQ(result, "false");
  }
}

CRUCIBLE_TEST_SCENARIO(format_cstring)
{
  {
    auto const result { format("{}", "") };
    CRUCIBLE_CORE_ASSERT_EQ(result, "");
  }

  {
    auto const result { format("{}", "hello") };
    CRUCIBLE_CORE_ASSERT_EQ(result, "hello");
  }
}

You must log in to comment.