Skip to content

Commit 4907d0c

Browse files
committed
Optimize tests
1 parent 6312c40 commit 4907d0c

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

tests/src/exec.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
using namespace php;
44

5-
TEST(variant, toCString) {
6-
std::string s1("hello world");
7-
Variant s2("hello world");
8-
ASSERT_STREQ(s1.c_str(), s2.toCString());
5+
TEST(exec, func) {
6+
auto retval = exec("is_dir", "/tmp");
7+
ASSERT_TRUE(retval.toBool());
98
}

tests/src/hash.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "phpx_test.h"
2+
3+
using namespace php;
4+
5+
TEST(hash, md5) {
6+
constexpr int l = 1024;
7+
auto rdata = exec("random_byets", l);
8+
ASSERT_EQ(rdata.length(), l);
9+
String str(rdata);
10+
String hash1 = md5(str);
11+
auto hash2 = exec("md5", rdata);
12+
ASSERT_STREQ(hash1.c_str(), hash2.toCString());
13+
}

tests/src/variant.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
using namespace php;
44

5-
TEST(exec, func) {
6-
auto retval = exec("is_dir", "/tmp");
7-
ASSERT_TRUE(retval.toBool());
5+
TEST(variant, toCString) {
6+
std::string s1("hello world");
7+
Variant s2("hello world");
8+
ASSERT_STREQ(s1.c_str(), s2.toCString());
89
}

0 commit comments

Comments
 (0)