MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/stl/format.cpp:7–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "fl/stl/format.h"
6
7FL_TEST_FILE(FL_FILEPATH) {
8
9using namespace fl;
10
11// =============================================================================
12// Basic placeholder tests
13// =============================================================================
14
15FL_TEST_CASE("format - no arguments") {
16 fl::string result = fl::format("Hello, World!");
17 FL_CHECK(result == "Hello, World!");
18}
19
20FL_TEST_CASE("format - empty string") {
21 fl::string result = fl::format("");
22 FL_CHECK(result == "");
23}
24
25FL_TEST_CASE("format - single placeholder") {
26 fl::string result = fl::format("Hello {}!", "World");
27 FL_CHECK(result == "Hello World!");
28}
29
30FL_TEST_CASE("format - single integer") {
31 fl::string result = fl::format("Value: {}", 42);
32 FL_CHECK(result == "Value: 42");
33}
34
35FL_TEST_CASE("format - multiple placeholders") {
36 fl::string result = fl::format("{} + {} = {}", 2, 3, 5);
37 FL_CHECK(result == "2 + 3 = 5");
38}
39
40FL_TEST_CASE("format - six arguments") {
41 fl::string result = fl::format("{} {} {} {} {} {}", 1, 2, 3, 4, 5, 6);
42 FL_CHECK(result == "1 2 3 4 5 6");
43}
44
45FL_TEST_CASE("format - eight arguments") {
46 fl::string result = fl::format("{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8);
47 FL_CHECK(result == "12345678");
48}
49
50// =============================================================================
51// Indexed arguments
52// =============================================================================
53
54FL_TEST_CASE("format - indexed arguments") {
55 fl::string result = fl::format("{1} before {0}", "A", "B");
56 FL_CHECK(result == "B before A");
57}
58
59FL_TEST_CASE("format - repeated index") {
60 fl::string result = fl::format("{0} {0} {0}", "echo");
61 FL_CHECK(result == "echo echo echo");
62}
63
64FL_TEST_CASE("format - mixed indexed") {

Callers

nothing calls this directly

Calls 4

formatFunction · 0.85
strstrFunction · 0.85
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected