[Midnightbsd-cvs] src [10873] trunk/lib/libcrypt/tests: add tags
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Jun 13 19:49:31 EDT 2018
Revision: 10873
http://svnweb.midnightbsd.org/src/?rev=10873
Author: laffer1
Date: 2018-06-13 19:49:30 -0400 (Wed, 13 Jun 2018)
Log Message:
-----------
add tags
Added Paths:
-----------
trunk/lib/libcrypt/tests/
trunk/lib/libcrypt/tests/Makefile
trunk/lib/libcrypt/tests/crypt_tests.c
Added: trunk/lib/libcrypt/tests/Makefile
===================================================================
--- trunk/lib/libcrypt/tests/Makefile (rev 0)
+++ trunk/lib/libcrypt/tests/Makefile 2018-06-13 23:49:30 UTC (rev 10873)
@@ -0,0 +1,17 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/lib/libcrypt/tests/Makefile 319252 2017-05-30 21:03:44Z asomers $
+
+SRCTOP= ${.CURDIR:H:H:H}
+OBJTOP= ${.OBJDIR:H:H:H}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libcrypt
+
+NETBSD_ATF_TESTS_C+= crypt_test
+
+WARNS?= 6
+CFLAGS+= -I${.CURDIR:H}
+DPADD+= ${LIBCRYPT}
+LDADD+= -lcrypt
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
Property changes on: trunk/lib/libcrypt/tests/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libcrypt/tests/crypt_tests.c
===================================================================
--- trunk/lib/libcrypt/tests/crypt_tests.c (rev 0)
+++ trunk/lib/libcrypt/tests/crypt_tests.c 2018-06-13 23:49:30 UTC (rev 10873)
@@ -0,0 +1,55 @@
+/* $MidnightBSD$ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libcrypt/tests/crypt_tests.c 256366 2013-10-12 06:08:18Z rpaulo $");
+
+#include <sys/types.h>
+#include <crypt.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+#define LEET "0.s0.l33t"
+
+ATF_TC(md5);
+ATF_TC_HEAD(md5, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Tests the MD5 based password hash");
+}
+
+ATF_TC_BODY(md5, tc)
+{
+ const char want[] = "$1$deadbeef$0Huu6KHrKLVWfqa4WljDE0";
+ char *pw;
+
+ pw = crypt(LEET, want);
+ ATF_CHECK_STREQ(pw, want);
+}
+
+ATF_TC(invalid);
+ATF_TC_HEAD(invalid, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Tests that invalid password fails");
+}
+
+ATF_TC_BODY(invalid, tc)
+{
+ const char want[] = "$1$cafebabe$0Huu6KHrKLVWfqa4WljDE0";
+ char *pw;
+
+ pw = crypt(LEET, want);
+ ATF_CHECK(strcmp(pw, want) != 0);
+}
+
+/*
+ * This function must not do anything except enumerate
+ * the test cases, per atf-c-api(3).
+ */
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, md5);
+ ATF_TP_ADD_TC(tp, invalid);
+ return atf_no_error();
+}
Property changes on: trunk/lib/libcrypt/tests/crypt_tests.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list