mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
refactor: integrate no_nul into univalue unitester
This commit is contained in:
parent
98a0ae6b24
commit
70d807c355
7 changed files with 11 additions and 20 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
export LC_ALL=C.UTF-8
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{no_nul,test_json,unitester,object}}; do
|
for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{test_json,unitester,object}}; do
|
||||||
# shellcheck disable=SC2044
|
# shellcheck disable=SC2044
|
||||||
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
|
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
|
||||||
echo "Wrap $b ..."
|
echo "Wrap $b ..."
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
export LC_ALL=C.UTF-8
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{no_nul,test_json,unitester,object}}.exe; do
|
for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{test_json,unitester,object}}.exe; do
|
||||||
# shellcheck disable=SC2044
|
# shellcheck disable=SC2044
|
||||||
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
|
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
|
||||||
if (file "$b" | grep "Windows"); then
|
if (file "$b" | grep "Windows"); then
|
||||||
|
|
|
@ -373,7 +373,7 @@ endif
|
||||||
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
|
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
|
||||||
|
|
||||||
if ENABLE_TESTS
|
if ENABLE_TESTS
|
||||||
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester univalue/test/no_nul
|
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester
|
||||||
noinst_PROGRAMS += $(UNIVALUE_TESTS)
|
noinst_PROGRAMS += $(UNIVALUE_TESTS)
|
||||||
TESTS += $(UNIVALUE_TESTS)
|
TESTS += $(UNIVALUE_TESTS)
|
||||||
|
|
||||||
|
@ -382,11 +382,6 @@ univalue_test_unitester_LDADD = $(LIBUNIVALUE)
|
||||||
univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
|
univalue_test_unitester_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
|
||||||
univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
univalue_test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
||||||
|
|
||||||
univalue_test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
|
|
||||||
univalue_test_no_nul_LDADD = $(LIBUNIVALUE)
|
|
||||||
univalue_test_no_nul_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
|
|
||||||
univalue_test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
|
|
||||||
|
|
||||||
univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
|
univalue_test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
|
||||||
univalue_test_object_LDADD = $(LIBUNIVALUE)
|
univalue_test_object_LDADD = $(LIBUNIVALUE)
|
||||||
univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
|
univalue_test_object_CPPFLAGS = -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
|
||||||
|
|
|
@ -25,9 +25,6 @@ UNIVALUE_TEST_UNITESTER_INT += %reldir%/test/unitester.cpp
|
||||||
UNIVALUE_TEST_JSON_INT =
|
UNIVALUE_TEST_JSON_INT =
|
||||||
UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp
|
UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp
|
||||||
|
|
||||||
UNIVALUE_TEST_NO_NUL_INT =
|
|
||||||
UNIVALUE_TEST_NO_NUL_INT += %reldir%/test/no_nul.cpp
|
|
||||||
|
|
||||||
UNIVALUE_TEST_OBJECT_INT =
|
UNIVALUE_TEST_OBJECT_INT =
|
||||||
UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp
|
UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp
|
||||||
|
|
||||||
|
|
1
src/univalue/test/.gitignore
vendored
1
src/univalue/test/.gitignore
vendored
|
@ -2,7 +2,6 @@
|
||||||
object
|
object
|
||||||
unitester
|
unitester
|
||||||
test_json
|
test_json
|
||||||
no_nul
|
|
||||||
|
|
||||||
*.trs
|
*.trs
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#include <univalue.h>
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char buf[] = "___[1,2,3]___";
|
|
||||||
UniValue val;
|
|
||||||
return val.read(buf + 3, 7) ? 0 : 1;
|
|
||||||
}
|
|
|
@ -149,6 +149,13 @@ void unescape_unicode_test()
|
||||||
assert(val[0].get_str() == "\xf0\x9d\x85\xa1");
|
assert(val[0].get_str() == "\xf0\x9d\x85\xa1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void no_nul_test()
|
||||||
|
{
|
||||||
|
char buf[] = "___[1,2,3]___";
|
||||||
|
UniValue val;
|
||||||
|
assert(val.read(buf + 3, 7));
|
||||||
|
}
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
for (const auto& f: filenames) {
|
for (const auto& f: filenames) {
|
||||||
|
@ -156,6 +163,7 @@ int main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
unescape_unicode_test();
|
unescape_unicode_test();
|
||||||
|
no_nul_test();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue