| 8 | ////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | static 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 | |
| 51 | static void test(void) { |
| 52 | acl::string path("/data1/www/video/test/test.ts"); |