| 2 | #include "set.h" |
| 3 | |
| 4 | void Main() { |
| 5 | StrArr *arr |
| 6 | = ReadProcessLines(new Str("seq"), new StrArr(1, new Str("10000"))); |
| 7 | Check(arr->len() == 10001, "read process output as lines"); |
| 8 | Word hash = 0; |
| 9 | for (StrArr::Each it(arr); it; ++it) { |
| 10 | hash += Hash(*it); |
| 11 | } |
| 12 | Check((hash & 0xffff) == 0xc756, "hashing strings"); |
| 13 | Str *data = ReadFile("/dev/null"); |
| 14 | FileInfo *finfo = FileStat(__FILE__); |
| 15 | Check(finfo != NULL && finfo->is_file && finfo->size > 0, "file stat"); |
| 16 | Check(data && data->len() == 0, "read bytes from file"); |
| 17 | arr = ReadLines(__FILE__); |
| 18 | Check(arr && arr->len() > __LINE__, "read lines from file"); |
| 19 | Check(WriteFile("/dev/null", S("test")), "write bytes to file"); |
| 20 | static CStr args[] = { "17" }; |
| 21 | Check(System(S("exit"), StrArrLit(args)) == 17, "invoke shell"); |
| 22 | Check(ListFiles(".")->len() > 0, "reading directories"); |
| 23 | StrSet *files = new StrSet(ListFiles("adlib")); |
| 24 | files = new StrSet(ListFileTree(CurrentDir(), ListFilesRelative)); |
| 25 | Check(files->contains(S(__FILE__)), "reading directories recursively"); |
| 26 | } |
nothing calls this directly
no test coverage detected