| 72 | } |
| 73 | |
| 74 | void test_csv_rfc_4180(void) |
| 75 | { |
| 76 | csv_record *ret; |
| 77 | |
| 78 | ok(!_parse_csv_record(_str(" \t"), CSV_RFC_4180)); |
| 79 | ok(!_parse_csv_record(_str(" \n"), CSV_RFC_4180)); |
| 80 | ok(!_parse_csv_record(_str(" \r"), CSV_RFC_4180)); |
| 81 | ok(!_parse_csv_record(_str("\ta"), CSV_RFC_4180)); |
| 82 | ok(!_parse_csv_record(_str("a,\tb"), CSV_RFC_4180)); |
| 83 | ok(!_parse_csv_record(_str("a,b\n"), CSV_RFC_4180)); |
| 84 | ok(!_parse_csv_record(_str("a,b,c\t"), CSV_RFC_4180)); |
| 85 | |
| 86 | ret = _parse_csv_record(_str(""), CSV_RFC_4180); |
| 87 | ok(str_match(&ret->s, const_str(""))); |
| 88 | ok(!ret->next); |
| 89 | free_csv_record(ret); |
| 90 | |
| 91 | ret = _parse_csv_record(_str(" a "), CSV_RFC_4180); |
| 92 | ok(str_match(&ret->s, const_str(" a "))); |
| 93 | ok(!ret->next); |
| 94 | free_csv_record(ret); |
| 95 | |
| 96 | ret = _parse_csv_record(_str(" \r\n"), CSV_RFC_4180); |
| 97 | ok(str_match(&ret->s, const_str(" "))); |
| 98 | ok(!ret->next); |
| 99 | free_csv_record(ret); |
| 100 | |
| 101 | ret = _parse_csv_record(_str(","), CSV_RFC_4180); |
| 102 | ok(str_match(&ret->s, const_str(""))); |
| 103 | ok(str_match(&ret->next->s, const_str(""))); |
| 104 | ok(!ret->next->next); |
| 105 | free_csv_record(ret); |
| 106 | |
| 107 | ret = _parse_csv_record(_str("a,,,"), CSV_RFC_4180); |
| 108 | ok(str_match(&ret->s, const_str("a"))); |
| 109 | ok(str_match(&ret->next->s, const_str(""))); |
| 110 | ok(str_match(&ret->next->next->s, const_str(""))); |
| 111 | ok(str_match(&ret->next->next->next->s, const_str(""))); |
| 112 | ok(!ret->next->next->next->next); |
| 113 | free_csv_record(ret); |
| 114 | |
| 115 | ret = _parse_csv_record(_str(" , a "), CSV_RFC_4180); |
| 116 | ok(str_match(&ret->s, const_str(" "))); |
| 117 | ok(str_match(&ret->next->s, const_str(" a "))); |
| 118 | ok(!ret->next->next); |
| 119 | free_csv_record(ret); |
| 120 | |
| 121 | ret = _parse_csv_record(_str(" a , \r\n"), CSV_RFC_4180); |
| 122 | ok(str_match(&ret->s, const_str(" a "))); |
| 123 | ok(str_match(&ret->next->s, const_str(" "))); |
| 124 | ok(!ret->next->next); |
| 125 | free_csv_record(ret); |
| 126 | |
| 127 | ret = _parse_csv_record(_str("a,b,c"), CSV_RFC_4180); |
| 128 | ok(str_match(&ret->s, const_str("a"))); |
| 129 | ok(str_match(&ret->next->s, const_str("b"))); |
| 130 | ok(str_match(&ret->next->next->s, const_str("c"))); |
| 131 | ok(!ret->next->next->next); |
no test coverage detected