-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmain.cpp
87 lines (75 loc) · 1.76 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
#include "include/CSVWriter.h"
using namespace std;
void test1(){
CSVWriter csv(",");
csv << "this" << "is" << "a" << "row";
cout << csv << endl;
}
void test2(){
CSVWriter csv;
csv.newRow() << "this" << "is" << "the" << "first" << "row";
csv.newRow() << "this" << "is" << "the" << "second" << "row";
cout << csv << endl;
}
void test3(){
CSVWriter csv;
csv.enableAutoNewRow(5);
csv << "this" << "is" << "the" << "first" << "row" << "this" << "is" << "the" << "second" << "row";
cout << csv << endl;
}
void test4(){
CSVWriter csv;
csv.newRow() << "this" << "is" << "the" << "first" << "row";
csv.newRow() << "this" << "is" << "the" << "second" << "row";
cout << csv.writeToFile("foobar.csv") << endl;
}
void test5(){
CSVWriter csv;
csv << "append" << "this" << "row" << "please" << ":)";
cout << csv.writeToFile("foobar.csv",true) << endl;
}
void test6(){
CSVWriter csv_a;
CSVWriter csv_b;
csv_a << "this" << "comes" << "from" << "csv_a";
csv_b << "this" << "is" << "from" << "csv_b";
csv_b += csv_a;
cout << csv_b << endl;
}
void test7(){
char c = 'c';
bool b = false;
short s = 6000;
int i = 300000;
float f = 3.14159;
double d = 4.85875e-270;
string str = "hello world";
char c_str[] = "whats up";
CSVWriter csv;
csv << c << b << s << i << f << d << str << c_str ;
cout << csv << endl;
}
void test8(){
CSVWriter csv;
csv << "escape;me;please";
cout << csv << endl;
}
void test9(){
CSVWriter csv;
csv << "escape\"me\"please\"\":)";
cout << csv << endl;
}
int main()
{
test1();
test2();
test3();
test4();
test5();
test6();
test7();
test8();
test9();
return 0;
}