1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include "wvtest.h"
#include "strutils.h"
#include <stdlib.h>
WVTEST_MAIN("passwd_crypttest.cc")
{
srandom(time(0));
char *blank, *word, *longword;
WvString blank_result1, blank_result2, word_result, longword_result;
blank = "";
word = "12345678";
longword = "1234567890000000000000000000000000000";
blank_result1 = passwd_crypt(blank);
blank_result2 = passwd_crypt(blank);
word_result = passwd_crypt(word);
longword_result = passwd_crypt(longword);
WVPASS(!!blank_result1 && blank_result1 != "*");
WVPASS(!!blank_result2 && blank_result2 != "*");
WVFAIL(blank_result1 == blank_result2);
WVPASS(!!word_result && word_result != "*");
WVPASS(!!longword_result && longword_result != "*");
}
WVTEST_MAIN("passwd_md5test.cc")
{
srandom(time(0));
char *blank, *word, *longword;
WvString blank_result1, blank_result2, word_result, longword_result;
blank = "";
word = "12345678";
longword = "1234567890000000000000000000000000000";
blank_result1 = passwd_md5(blank);
blank_result2 = passwd_md5(blank);
word_result = passwd_md5(word);
longword_result = passwd_md5(longword);
WVPASS(!!blank_result1 && blank_result1 != "*");
WVPASS(!!blank_result2 && blank_result2 != "*");
WVFAIL(blank_result1 == blank_result2);
WVPASS(!!word_result && word_result != "*");
WVPASS(!!longword_result && longword_result != "*");
}
|