riscv: [Patch 4/5] Added RISC-V atomic memory extension RV64A
[gem5.git] / src / unittest / cprintftest.cc
index 7fb10375ce9f11a02f49bc201c7baaf8af8b642a..7e6d2f2d46a8c0ede8ea2d6a001ea083a971850c 100644 (file)
 
 #include <iostream>
 #include <list>
-#include <string>
 #include <sstream>
+#include <string>
 
 #include "base/cprintf.hh"
+#include "base/misc.hh"
 
 using namespace std;
 
@@ -43,6 +44,14 @@ main()
     char foo[] = "foo";
     cprintf("%s\n", foo);
 
+    string _bar = "asdfkhasdlkfjhasdlkfhjalksdjfhalksdjhfalksdjfhalksdjhf";
+    int length = 11;
+    char bar[length + 1];
+    bar[length] = 0;
+
+    memcpy(bar, _bar.c_str(), length);
+    warn("%s\n", bar);
+
     cprintf("%d\n", 'A');
     cprintf("%shits%%s + %smisses%%s\n", "test", "test");
     cprintf("%%s%-10s %c he went home \'\"%d %#o %#x %1.5f %1.2E\n",
@@ -158,6 +167,13 @@ main()
 
     cprintf("%c  %c\n", 'c', 65);
 
-    cout << '9';
+    cout << '9' << endl;
+
+    cout << endl;
+
+    cprintf("%08.4f\n", 99.99);
+    cprintf("%0*.*f\n", 8, 4, 99.99);
+    cprintf("%07.*f\n", 4, 1.234);
+    cprintf("%#0*x\n", 9, 123412);
     return 0;
 }