aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2015-04-25 07:47:44 +0900
committerMITSUNARI Shigeo <[email protected]>2015-04-25 07:47:44 +0900
commitfca4af9ecaf0ac2e80065c362a36adff12fc0678 (patch)
treea3a1c23b715c0ab35b5fc154c846431c21ff8843
parentdcf8ca01f789329aee03cd4947eacb2a80614cfa (diff)
downloadxbyak-fca4af9ecaf0ac2e80065c362a36adff12fc0678.tar.gz
xbyak-fca4af9ecaf0ac2e80065c362a36adff12fc0678.zip
add test of setSize
-rw-r--r--test/Makefile4
-rw-r--r--test/misc.cpp23
-rwxr-xr-xtest/test_misc.bat5
3 files changed, 31 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile
index 10f432d..299cf33 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,4 +1,4 @@
-TARGET = make_nm normalize_prefix jmp address nm_frame bad_address
+TARGET = make_nm normalize_prefix jmp address nm_frame bad_address misc
XBYAK_INC=../xbyak/xbyak.h
BIT=32
ifeq ($(shell uname -m),x86_64)
@@ -32,6 +32,8 @@ nm_frame: nm_frame.cpp ../xbyak/xbyak.h
$(CXX) $(CFLAGS) nm_frame.cpp -o $@ -m32
bad_address: bad_address.cpp ../xbyak/xbyak.h
$(CXX) $(CFLAGS) bad_address.cpp -o $@
+misc: misc.cpp ../xbyak/xbyak.h
+ $(CXX) $(CFLAGS) misc.cpp -o $@
test: normalize_prefix jmp bad_address
./test_nm.sh
diff --git a/test/misc.cpp b/test/misc.cpp
new file mode 100644
index 0000000..76a4d56
--- /dev/null
+++ b/test/misc.cpp
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <string.h>
+#include <string>
+#include <xbyak/xbyak.h>
+#include <cybozu/inttype.hpp>
+#include <cybozu/test.hpp>
+
+using namespace Xbyak;
+
+CYBOZU_TEST_AUTO(setSize)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code() : Xbyak::CodeGenerator(4096)
+ {
+ setSize(4095);
+ db(1);
+ size_t size = getSize();
+ CYBOZU_TEST_EQUAL(size, 4096);
+ CYBOZU_TEST_NO_EXCEPTION(setSize(size));
+ CYBOZU_TEST_EXCEPTION(db(1), Xbyak::Error);
+ }
+ } code;
+}
diff --git a/test/test_misc.bat b/test/test_misc.bat
new file mode 100755
index 0000000..9aeb925
--- /dev/null
+++ b/test/test_misc.bat
@@ -0,0 +1,5 @@
+pushd ..\gen
+call update
+popd
+cl -I../ -I./ -DXBYAK_TEST misc.cpp %OPT% /Od /Zi
+misc