]> git.tdb.fi Git - libs/core.git/blobdiff - tests/console/console.cpp
Add unit tests
[libs/core.git] / tests / console / console.cpp
diff --git a/tests/console/console.cpp b/tests/console/console.cpp
new file mode 100644 (file)
index 0000000..04ad4ac
--- /dev/null
@@ -0,0 +1,26 @@
+#include <msp/io/console.h>
+#include <msp/io/poll.h>
+#include <msp/io/print.h>
+
+using namespace Msp;
+
+int main()
+{
+       IO::cin.set_local_echo(false);
+       IO::cin.set_line_buffer(false);
+       while(1)
+       {
+               if(IO::poll(IO::cin, IO::P_INPUT)==IO::P_INPUT)
+               {
+                       char c = IO::cin.get();
+                       IO::print("Got character '%c' (%02X)\n", c, c);
+               }
+               else
+               {
+                       IO::print("EOF\n");
+                       break;
+               }
+       }
+
+       return 0;
+}