We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 074dff7 commit 6e906b2Copy full SHA for 6e906b2
tests/device/test_iostream/test_iostream.ino
@@ -0,0 +1,34 @@
1
+#include <ESP8266WiFi.h>
2
+#include <BSTest.h>
3
+#include <sstream>
4
+#include <iostream>
5
+
6
+BS_ENV_DECLARE();
7
8
+void setup()
9
+{
10
+ Serial.begin(115200);
11
+ BS_RUN(Serial);
12
+}
13
14
+TEST_CASE("can print to std::cout", "[iostream]")
15
16
+ std::stringstream test_stream("");
17
+ test_stream << "hello stream";
18
19
+ // empty the RX buffer, just in case
20
+ Serial.readString();
21
22
+ USC0(0) |= (1 << UCLBE); // enable loopback
23
+ std::cout << test_stream.str().c_str() << std::endl;
24
+ delay(100);
25
+ USC0(0) &= ~(1 << UCLBE); // disable loopback
26
27
+ String result = Serial.readStringUntil('\n');
28
29
+ Serial.printf("result: '%s'\n", result.c_str());
30
31
+ CHECK(result == test_stream.str().c_str());
32
33
34
+void loop() { }
0 commit comments