aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/nm_frame.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2010-04-16 10:33:04 +0900
committerMITSUNARI Shigeo <[email protected]>2010-04-16 10:33:04 +0900
commitcbb4ca2178c6bd391b48c130afececfdddc66836 (patch)
tree46c9cfe83e040443af60585e212d071f0f127ebc /test/nm_frame.cpp
downloadxbyak-cbb4ca2178c6bd391b48c130afececfdddc66836.tar.gz
xbyak-cbb4ca2178c6bd391b48c130afececfdddc66836.zip
first commit
Diffstat (limited to 'test/nm_frame.cpp')
-rw-r--r--test/nm_frame.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/nm_frame.cpp b/test/nm_frame.cpp
new file mode 100644
index 0000000..d63cab1
--- /dev/null
+++ b/test/nm_frame.cpp
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include "xbyak/xbyak.h"
+
+using namespace Xbyak;
+
+class Sample : public CodeGenerator {
+ void operator=(const Sample&);
+public:
+ void gen()
+ {
+ try {
+
+#include "nm.cpp"
+
+ } catch (Xbyak::Error err) {
+ printf("ERR:%s(%d)\n", ConvertErrorToString(err), err);
+ } catch (...) {
+ printf("unkwon error\n");
+ }
+ }
+};
+
+
+#define _STR(x) #x
+#define TEST(syntax) err = true; try { syntax; err = false; } catch (Xbyak::Error) { } catch (...) { } if (!err) printf("should be err:%s;\n", _STR(syntax))
+
+class ErrorSample : public CodeGenerator {
+ void operator=(const ErrorSample&);
+public:
+ void gen()
+ {
+ bool err;
+ TEST(mov(ptr[eax],1));
+ TEST(test(ptr[eax],1));
+ TEST(adc(ptr[eax],1));
+ TEST(setz(eax));
+ }
+};
+int main()
+{
+ Sample s;
+ s.gen();
+ ErrorSample es;
+ es.gen();
+}