MCPcopy Create free account
hub / github.com/acl-dev/acl / test_main

Function test_main

lib_acl_cpp/samples/string/string2/main.cpp:10–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8//////////////////////////////////////////////////////////////////////////
9
10static void test_main(bool move) {
11 acl::string s("hello world!\r\n"
12 "you're welcome\r\n"
13 "what's your name\r\n"
14 "happy new year");
15 acl::string line;
16
17 while (true) {
18 if (s.scan_line(line, true, NULL) == true) {
19 printf(">>line: %s, rest len: %d\r\n",
20 line.c_str(), (int) s.length());
21 line.clear();
22
23 if (move) {
24 s.scan_move();
25 }
26 } else {
27 if (s.empty()) {
28 break;
29 }
30
31 printf(">>last: %s, len: %d\r\n",
32 s.c_str(), (int) s.length());
33
34 acl_assert(strlen(s.c_str()) == s.length());
35
36 if (move) {
37 s.scan_move();
38 }
39
40 printf("=======================================\r\n");
41 printf(">>string len: %d, buf len: %d, buf: \r\n%s\r\n",
42 (int) s.length(), (int) strlen((char*) s.buf()),
43 (char*) s.buf());
44 printf("=======================================\r\n");
45
46 break;
47 }
48 }
49}
50
51static void test(void) {
52 acl::string path("/data1/www/video/test/test.ts");

Callers 1

mainFunction · 0.70

Calls 7

scan_lineMethod · 0.80
scan_moveMethod · 0.80
bufMethod · 0.80
c_strMethod · 0.45
lengthMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…