]> begriffs open source - sa-parse/blob - tests/README.md
Expose line/column numbers directly to caller
[sa-parse] / tests / README.md
1 # CSV Parser Test Files
2
3 This directory contains various test cases for the CSV parser to verify it handles different CSV formats correctly.
4
5 ## Test Files
6
7 ### `test.csv` (Basic Test)
8 Simple CSV with header and data rows containing:
9 - Regular unquoted fields
10 - Quoted fields with spaces and commas
11 - Mixed quoted and unquoted fields
12
13 ### `complex.csv` (Complex Field Content)
14 Tests handling of:
15 - Names with commas and apostrophes
16 - City names with commas and state abbreviations
17 - Mixed international data
18
19 ### `quotes.csv` (Quote Handling)
20 Tests proper handling of:
21 - Escaped quotes within quoted fields (`""`)
22 - Multi-line field content
23 - Mixed quoted and unquoted fields
24
25 ### `empty_fields.csv` (Empty Fields)
26 Tests handling of:
27 - Empty fields at start, middle, and end of records
28 - Records with all empty fields
29 - Mixed empty and populated fields
30
31 ### `header_only.csv` (Header Only)
32 Tests parsing of CSV file with only a header row and no data.
33
34 ### `empty.csv` (Empty File)
35 Tests parsing of completely empty CSV file.
36
37 ## Running Tests
38
39 From the `src` directory, you can test the parser with any of these files:
40
41 ```bash
42 # Test basic functionality
43 ./csv_parser < ../tests/test.csv
44
45 # Test complex field handling
46 ./csv_parser < ../tests/complex.csv
47
48 # Test quote handling
49 ./csv_parser < ../tests/quotes.csv
50
51 # Test empty field handling
52 ./csv_parser < ../tests/empty_fields.csv
53
54 # Test header-only files
55 ./csv_parser < ../tests/header_only.csv
56
57 # Test empty files
58 ./csv_parser < ../tests/empty.csv
59 ```
60
61 ## Expected Behavior
62
63 The parser should successfully parse all test files and display:
64 1. "Parsing successful!" message
65 2. Header information (if present)
66 3. Record information with proper field separation
67 4. Proper handling of quoted content and escape sequences