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

Function FL_TEST_FILE

tests/fl/stl/strstream_integers.cpp:10–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "fl/stl/string.h"
9
10FL_TEST_FILE(FL_FILEPATH) {
11
12FL_TEST_CASE("sstream handles all integer types generically") {
13 fl::sstream ss;
14
15 FL_SUBCASE("signed char types") {
16 signed char sc = -42;
17 ss << sc;
18 FL_CHECK(ss.str() == "-42");
19 }
20
21 FL_SUBCASE("unsigned char types") {
22 unsigned char uc = 200;
23 ss.clear();
24 ss << uc;
25 FL_CHECK(ss.str() == "200");
26 }
27
28 FL_SUBCASE("short types") {
29 short s = -12345;
30 ss.clear();
31 ss << s;
32 FL_CHECK(ss.str() == "-12345");
33
34 unsigned short us = 54321;
35 ss.clear();
36 ss << us;
37 FL_CHECK(ss.str() == "54321");
38 }
39
40 FL_SUBCASE("int types") {
41 int i = -123456;
42 ss.clear();
43 ss << i;
44 FL_CHECK(ss.str() == "-123456");
45
46 unsigned int ui = 654321;
47 ss.clear();
48 ss << ui;
49 FL_CHECK(ss.str() == "654321");
50 }
51
52 FL_SUBCASE("long types") {
53 long l = -1234567;
54 ss.clear();
55 ss << l;
56 FL_CHECK(ss.str() == "-1234567");
57
58 unsigned long ul = 7654321;
59 ss.clear();
60 ss << ul;
61 FL_CHECK(ss.str() == "7654321");
62 }
63
64 FL_SUBCASE("long long types") {
65 long long ll = -123456789012345LL;
66 ss.clear();
67 ss << ll;

Callers

nothing calls this directly

Calls 7

setTreatCharAsIntMethod · 0.80
stringClass · 0.50
strMethod · 0.45
clearMethod · 0.45
writeMethod · 0.45
c_strMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected