From 5219e2e3d004e52a8a08cb96536e30ced7001b95 Mon Sep 17 00:00:00 2001 From: gumi Date: Mon, 22 Oct 2018 15:26:36 -0400 Subject: add unit tests for data_to_string --- npc/dev/test.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'npc') diff --git a/npc/dev/test.txt b/npc/dev/test.txt index c2f07ab2f..2822ee65c 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -775,6 +775,16 @@ function script HerculesSelfTestHelper { callsub(OnCheck, "Getdatatype (getarg integer value)", callsub(OnTestGetdatatype, 5), DATATYPE_INT); callsub(OnCheck, "Getdatatype (getarg string)", callsub(OnTestGetdatatype, "foo"), DATATYPE_STR | DATATYPE_CONST); + callsub(OnCheck, "data_to_string (NIL)", data_to_string(), ""); + callsub(OnCheck, "data_to_string (empty string)", data_to_string(""), ""); + callsub(OnCheck, "data_to_string (string)", data_to_string("foo"), "foo"); + callsub(OnCheck, "data_to_string (integer)", data_to_string(5), "5"); + callsub(OnCheck, "data_to_string (parameter)", data_to_string(Hp), "Hp"); + callsub(OnCheck, "data_to_string (constant)", data_to_string(DATATYPE_CONST), "DATATYPE_CONST"); + callsub(OnCheck, "data_to_string (label)", data_to_string(OnTestGetdatatype), "OnTestGetdatatype"); + callsub(OnCheck, "data_to_string (string variable)", data_to_string(.@x$), ".@x$"); + callsub(OnCheck, "data_to_string (integer variable)", data_to_string(.@x), ".@x"); + if (.errors) { debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]"; debugmes "**** The test was completed with " + .errors + " errors. ****"; -- cgit v1.2.3-70-g09d2