Lolly 1.4.28
Loading...
Searching...
No Matches
md5_test.cpp
Go to the documentation of this file.
1
2/******************************************************************************
3 * MODULE : md5_test.cpp
4 * DESCRIPTION: tests on md5
5 * COPYRIGHT : (C) 2023 Darcy Shen
6 *******************************************************************************
7 * This software falls under the GNU general public license version 3 or later.
8 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10 ******************************************************************************/
11
12#include "a_lolly_test.hpp"
13#include "file.hpp"
14#include "lolly/hash/md5.hpp"
15
17
18TEST_CASE ("md5_hexdigest") {
19 SUBCASE ("normal file") {
20 string_eq (md5_hexdigest (url_pwd () * "LICENSE"),
21 "d32239bcb673463ab874e80d47fae504");
22 }
23 SUBCASE ("empty file") {
24 url temp= url_temp ();
25 string_save ("", temp);
26 CHECK_EQ (file_size (temp), 0);
27 string_eq (md5_hexdigest (temp), "d41d8cd98f00b204e9800998ecf8427e");
28 }
29 SUBCASE ("invalid file") {
30 string_eq (md5_hexdigest (url_system ("https://mogan.app")), "");
31 string_eq (md5_hexdigest (url_system ("/path/to/not_exist")), "");
32 }
33}
The list class represents a linked list.
Definition list.hpp:48
Definition url.hpp:37
void string_save(const string &s, url u)
Definition file.cpp:496
url url_temp(string suffix)
Definition file.cpp:274
int file_size(url u)
Definition file.cpp:155
void string_eq(string left, string right)
string md5_hexdigest(url u)
Definition md5.cpp:22
TEST_CASE("test for operator+= and advance()")
url url_system(string name)
Definition url.cpp:306
url url_pwd()
Definition url.cpp:326