Skip to content

Commit b50daa1

Browse files
committed
Tests for various String addition cases.
1 parent d12fe18 commit b50daa1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

libraries/ArduinoTestSuite/examples/ATS_String_Addition/ATS_String_Addition.pde

+13-8
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,22 @@ void setup()
2626
Test_Equal("Adding strings doesn't change them", "string", stringOne);
2727
Test_Equal("Adding strings doesn't change them", "other", stringTwo);
2828
Test_Equal("Add strings", "stringotherstringstringstringother", stringOne + stringTwo + stringOne + stringOne + stringOne + stringTwo);
29-
Test_Equal("Add integer to string", "string123", stringOne + 123);
29+
Test_Equal("Add string to integer", "string12345", stringOne + 12345);
30+
Test_Equal("Add string to negative integer", "string-12345", stringOne + -12345);
3031
Test_Equal("Add integer to string", "123string", 123 + stringOne);
31-
Test_Equal("Add integers to string", "string123456", stringOne + 123 + 456);
32-
Test_Equal("Add integer sum to string", "string579", stringOne + (123 + 456));
33-
Test_Equal("Add integers to string", "string123456789", stringOne + 123 + 456 + 789);
34-
Test_Equal("Add integers to string", "123string456", 123 + stringOne + 456);
35-
Test_Equal("Add long to string", "string123456789", stringOne + 123456789);
32+
Test_Equal("Add string to integers", "string123456789", stringOne + 123 + 456 + 789);
33+
Test_Equal("Add integer to string", "123string456789", 123 + stringOne + 456 + 789);
34+
Test_Equal("Add string to long", "string123456789", stringOne + 123456789L);
35+
Test_Equal("Add string to negative long", "string-123456789", stringOne + -123456789L);
36+
Test_Equal("Add string to unsigned long", "string123456789", stringOne + 123456789UL);
37+
Test_Equal("Add string to byte", "string123", stringOne + byte(123));
3638
Test_Equal("Add char", "stringA", stringOne + 'A');
3739
Test_Equal("Add char", "Astring", 'A' + stringOne);
38-
Test_Equal("Add \"string\"", "stringabc", stringOne + "abc");
39-
Test_Equal("Add multiple types", "string123A123456789", stringOne + 123 + 'A' + 123456789);
40+
Test_Equal("Add \"string\"", "stringabc", stringOne + "abc");
41+
Test_Equal("Add \"string\"", "abcstring", "abc" + stringOne);
42+
Test_Equal("Add multiple \"string\"", "stringabcdef", stringOne + "abc" + "def");
43+
Test_Equal("Add multiple \"string\"", "abcstringdef", "abc" + stringOne + "def");
44+
Test_Equal("Add \"string\" and int", "bc", "abc" + 1);
4045

4146
ATS_end();
4247
}

0 commit comments

Comments
 (0)