aboutsummaryrefslogtreecommitdiffhomepage
path: root/test.c
diff options
context:
space:
mode:
authorPerlbotics <perlbotix@cpan.org>2017-11-16 00:14:04 +0100
committerPerlbotics <perlbotix@cpan.org>2017-11-16 00:20:25 +0100
commit3417c5e6d0a3647c6d453dbd3fad91649663df2b (patch)
treea8e70e69028d06e56b50a8a8f29e9204799aa740 /test.c
parent1316210f7d795de8ff7d4c5651501a33248b6e20 (diff)
downloadzxcvbn-c-3417c5e6d0a3647c6d453dbd3fad91649663df2b.tar.gz
Internal selftest added. Keyboard-layout integrity checked.
Test binaries perform additional selftests now. This helps to detect errors in keyboard layout definitions early.
Diffstat (limited to 'test.c')
-rw-r--r--test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test.c b/test.c
index 8a4797b..4634dab 100644
--- a/test.c
+++ b/test.c
@@ -33,6 +33,9 @@
#include "stdafx.h"
#endif
+/* forward declaration / not part of official API */
+unsigned int _selftest_errors();
+
const char *UsrDict[] =
{
"Onename.Twoname@example.com", "Onename", "Twoname", "example.com", "example",
@@ -207,9 +210,16 @@ int DoChecks(char *file)
int main(int argc, char **argv)
{
int i, Quiet, Checks, White;
+ unsigned int SelftestErrors;
Quiet = 0;
Checks = 0;
White = 0;
+
+ SelftestErrors = _selftest_errors();
+ printf("Selftest returned %d error(s).\n", SelftestErrors );
+ if (SelftestErrors)
+ return 1;
+
if (!ZxcvbnInit("zxcvbn.dict"))
{
printf("Failed to open dictionary file\n");