summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-07-11 11:23:15 +0200
committerHaru <haru@dotalux.com>2017-07-11 11:23:15 +0200
commit2623a35e451a463f4be14638b37bc294d08094a1 (patch)
tree5691af82d702f9fc964d5a0210138c1e1766d74c
parentf9ddfcc6e373ab8245ae6fb70737a284c55b3203 (diff)
downloadhercules-2623a35e451a463f4be14638b37bc294d08094a1.tar.gz
hercules-2623a35e451a463f4be14638b37bc294d08094a1.tar.bz2
hercules-2623a35e451a463f4be14638b37bc294d08094a1.tar.xz
hercules-2623a35e451a463f4be14638b37bc294d08094a1.zip
Add tests for getdatatype
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--npc/dev/test.txt23
1 files changed, 21 insertions, 2 deletions
diff --git a/npc/dev/test.txt b/npc/dev/test.txt
index b35beb8ed..a6f89f857 100644
--- a/npc/dev/test.txt
+++ b/npc/dev/test.txt
@@ -9,8 +9,8 @@
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
-//= Copyright (C) 2013-2015 Hercules Dev Team
-//= Copyright (C) 2013-2015 Haru
+//= Copyright (C) 2013-2017 Hercules Dev Team
+//= Copyright (C) 2013-2017 Haru
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
@@ -742,6 +742,19 @@ function script HerculesSelfTestHelper {
callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$+05d'", 5, 6), "'+0006'");
callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$s' '%1$c'", "First", "Second"), "'Second' 'F'");
+ callsub(OnCheck, "Getdatatype (integer)", getdatatype(5), DATATYPE_INT);
+ callsub(OnCheck, "Getdatatype (constant string)", getdatatype("foo"), DATATYPE_STR | DATATYPE_CONST);
+ callsub(OnCheck, "Getdatatype (parameter)", getdatatype(Hp), DATATYPE_INT | DATATYPE_PARAM);
+ callsub(OnCheck, "Getdatatype (numeric variable)", getdatatype(.@x), DATATYPE_INT | DATATYPE_VAR);
+ callsub(OnCheck, "Getdatatype (string variable)", getdatatype(.@x$), DATATYPE_STR | DATATYPE_VAR);
+ callsub(OnCheck, "Getdatatype (label)", getdatatype(OnTestGetdatatype), DATATYPE_LABEL);
+ //callsub(OnCheck, "Getdatatype (constant)", getdatatype(DATATYPE_CONST), DATATYPE_CONST); // FIXME
+ callsub(OnCheck, "Getdatatype (returned integer)", getdatatype(callsub(OnTestReturnValue, 5)), DATATYPE_INT);
+ callsub(OnCheck, "Getdatatype (returned string)", getdatatype(callsub(OnTestReturnValue, "foo")), DATATYPE_STR | DATATYPE_CONST);
+ callsub(OnCheck, "Getdatatype (getarg default value)", callsub(OnTestGetdatatypeDefault), DATATYPE_INT);
+ callsub(OnCheck, "Getdatatype (getarg integer value)", callsub(OnTestGetdatatype, 5), DATATYPE_INT);
+ callsub(OnCheck, "Getdatatype (getarg string)", callsub(OnTestGetdatatype, "foo"), DATATYPE_STR | DATATYPE_CONST);
+
if (.errors) {
debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]";
debugmes "**** The test was completed with " + .errors + " errors. ****";
@@ -786,6 +799,12 @@ OnTestScopeArrays:
OnTestVarOfAnotherNPC:
return getvariableofnpc(.x, getarg(0));
+OnTestGetdatatypeDefault:
+ return getdatatype(getarg(0, 0));
+
+OnTestGetdatatype:
+ return getdatatype(getarg(0));
+
OnReportError:
.@msg$ = getarg(0,"Unknown Error");
.@val$ = getarg(1,"");