about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-30 23:42:51 +0000
committerJames Booth <boothj5@gmail.com>2015-01-30 23:42:51 +0000
commita9ed64911d29819f20fe8cafae87af61b6f53e14 (patch)
treeba65d3c9d025aead76394b450c881efd87712740 /tests
parent83bd207316037a8086f15f37c0e187a2ffba2e14 (diff)
downloadprofani-tty-a9ed64911d29819f20fe8cafae87af61b6f53e14.tar.gz
Removed history and various key handlers
Diffstat (limited to 'tests')
-rw-r--r--tests/test_history.c219
-rw-r--r--tests/test_history.h13
-rw-r--r--tests/testsuite.c66
3 files changed, 0 insertions, 298 deletions
diff --git a/tests/test_history.c b/tests/test_history.c
deleted file mode 100644
index 1584b390..00000000
--- a/tests/test_history.c
+++ /dev/null
@@ -1,219 +0,0 @@
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-#include <stdlib.h>
-
-#include "tools/history.h"
-
-void previous_on_empty_returns_null(void **state)
-{
-    History history = history_new(10);
-    char *item = history_previous(history, "inp");
-
-    assert_null(item);
-}
-
-void next_on_empty_returns_null(void **state)
-{
-    History history = history_new(10);
-    char *item = history_next(history, "inp");
-
-    assert_null(item);
-}
-
-void previous_once_returns_last(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item = history_previous(history, "inp");
-
-    assert_string_equal("Hello", item);
-}
-
-void previous_twice_when_one_returns_first(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item1 = history_previous(history, NULL);
-    char *item2 = history_previous(history, item1);
-
-    assert_string_equal("Hello", item2);
-}
-
-void previous_always_stops_at_first(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item1 = history_previous(history, NULL);
-    char *item2 = history_previous(history, item1);
-    char *item3 = history_previous(history, item2);
-    char *item4 = history_previous(history, item3);
-    char *item5 = history_previous(history, item4);
-    char *item6 = history_previous(history, item5);
-
-    assert_string_equal("Hello", item6);
-}
-
-void previous_goes_to_correct_element(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-    history_append(history, "world");
-    history_append(history, "whats");
-    history_append(history, "going");
-    history_append(history, "on");
-    history_append(history, "here");
-
-    char *item1 = history_previous(history, NULL);
-    char *item2 = history_previous(history, item1);
-    char *item3 = history_previous(history, item2);
-
-    assert_string_equal("going", item3);
-}
-
-void prev_then_next_returns_empty(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item1 = history_previous(history, NULL);
-    char *item2 = history_next(history, item1);
-
-    assert_string_equal("", item2);
-}
-
-void prev_with_val_then_next_returns_val(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item1 = history_previous(history, "Oioi");
-    char *item2 = history_next(history, item1);
-
-    assert_string_equal("Oioi", item2);
-}
-
-void prev_with_val_then_next_twice_returns_null(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-
-    char *item1 = history_previous(history, "Oioi");
-    char *item2 = history_next(history, item1);
-    char *item3 = history_next(history, item2);
-
-    assert_null(item3);
-}
-
-void navigate_then_append_new(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-    history_append(history, "again");
-    history_append(history, "testing");
-    history_append(history, "history");
-    history_append(history, "append");
-
-    char *item1 = history_previous(history, "new text");
-    assert_string_equal("append", item1);
-
-    char *item2 = history_previous(history, item1);
-    assert_string_equal("history", item2);
-
-    char *item3 = history_previous(history, item2);
-    assert_string_equal("testing", item3);
-
-    char *item4 = history_next(history, item3);
-    assert_string_equal("history", item4);
-
-    char *item5 = history_next(history, item4);
-    assert_string_equal("append", item5);
-
-    char *item6 = history_next(history, item5);
-    assert_string_equal("new text", item6);
-}
-
-void edit_item_mid_history(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-    history_append(history, "again");
-    history_append(history, "testing");
-    history_append(history, "history");
-    history_append(history, "append");
-
-    char *item1 = history_previous(history, "new item");
-    assert_string_equal("append", item1);
-
-    char *item2 = history_previous(history, item1);
-    assert_string_equal("history", item2);
-
-    char *item3 = history_previous(history, item2);
-    assert_string_equal("testing", item3);
-
-    char *item4 = history_previous(history, "EDITED");
-    assert_string_equal("again", item4);
-
-    char *item5 = history_previous(history, item4);
-    assert_string_equal("Hello", item5);
-
-    char *item6 = history_next(history, item5);
-    assert_string_equal("again", item6);
-
-    char *item7 = history_next(history, item6);
-    assert_string_equal("EDITED", item7);
-
-    char *item8 = history_next(history, item7);
-    assert_string_equal("history", item8);
-
-    char *item9 = history_next(history, item8);
-    assert_string_equal("append", item9);
-
-    char *item10 = history_next(history, item9);
-    assert_string_equal("new item", item10);
-}
-
-void edit_previous_and_append(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "Hello");
-    history_append(history, "again");
-    history_append(history, "testing");
-    history_append(history, "history");
-    history_append(history, "append");
-
-    char *item1 = history_previous(history, "new item");
-    assert_string_equal("append", item1);
-
-    char *item2 = history_previous(history, item1);
-    assert_string_equal("history", item2);
-
-    char *item3 = history_previous(history, item2);
-    assert_string_equal("testing", item3);
-
-    history_append(history, "EDITED");
-
-    char *item4 = history_previous(history, NULL);
-    assert_string_equal("EDITED", item4);
-}
-
-void start_session_add_new_submit_previous(void **state)
-{
-    History history = history_new(10);
-    history_append(history, "hello");
-
-    char *item1 = history_previous(history, NULL);
-    assert_string_equal("hello", item1);
-
-    char *item2 = history_next(history, item1);
-    assert_string_equal("", item2);
-
-    char *item3 = history_previous(history, "new text");
-    assert_string_equal("hello", item3);
-
-    history_append(history, item3);
-}
diff --git a/tests/test_history.h b/tests/test_history.h
deleted file mode 100644
index e6e8ec3f..00000000
--- a/tests/test_history.h
+++ /dev/null
@@ -1,13 +0,0 @@
-void previous_on_empty_returns_null(void **state);
-void next_on_empty_returns_null(void **state);
-void previous_once_returns_last(void **state);
-void previous_twice_when_one_returns_first(void **state);
-void previous_always_stops_at_first(void **state);
-void previous_goes_to_correct_element(void **state);
-void prev_then_next_returns_empty(void **state);
-void prev_with_val_then_next_returns_val(void **state);
-void prev_with_val_then_next_twice_returns_null(void **state);
-void navigate_then_append_new(void **state);
-void edit_item_mid_history(void **state);
-void edit_previous_and_append(void **state);
-void start_session_add_new_submit_previous(void **state);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index ca53961f..92abee4b 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -21,7 +21,6 @@
 #include "test_cmd_sub.h"
 #include "test_cmd_statuses.h"
 #include "test_cmd_otr.h"
-#include "test_history.h"
 #include "test_jid.h"
 #include "test_parser.h"
 #include "test_roster_list.h"
@@ -35,7 +34,6 @@
 #include "test_cmd_win.h"
 #include "test_cmd_disconnect.h"
 #include "test_form.h"
-#include "test_keyhandlers.h"
 
 int main(int argc, char* argv[]) {
     const UnitTest all_tests[] = {
@@ -104,20 +102,6 @@ int main(int argc, char* argv[]) {
         unit_test(add_two_same_adds_one),
         unit_test(add_two_same_updates),
 
-        unit_test(previous_on_empty_returns_null),
-        unit_test(next_on_empty_returns_null),
-        unit_test(previous_once_returns_last),
-        unit_test(previous_twice_when_one_returns_first),
-        unit_test(previous_always_stops_at_first),
-        unit_test(previous_goes_to_correct_element),
-        unit_test(prev_then_next_returns_empty),
-        unit_test(prev_with_val_then_next_returns_val),
-        unit_test(prev_with_val_then_next_twice_returns_null),
-        unit_test(navigate_then_append_new),
-        unit_test(edit_item_mid_history),
-        unit_test(edit_previous_and_append),
-        unit_test(start_session_add_new_submit_previous),
-
         unit_test(create_jid_from_null_returns_null),
         unit_test(create_jid_from_empty_string_returns_null),
         unit_test(create_jid_from_full_returns_full),
@@ -623,56 +607,6 @@ int main(int argc, char* argv[]) {
         unit_test(remove_text_multi_value_removes_when_many),
 
         unit_test(clears_chat_sessions),
-
-        unit_test(append_to_empty),
-        unit_test(append_wide_to_empty),
-
-        unit_test(append_to_single),
-        unit_test(append_wide_to_single_non_wide),
-        unit_test(append_non_wide_to_single_wide),
-        unit_test(append_wide_to_single_wide),
-
-        unit_test(append_non_wide_when_overrun),
-
-        unit_test(insert_non_wide_to_non_wide),
-        unit_test(insert_single_non_wide_when_pad_scrolled),
-        unit_test(insert_many_non_wide_when_pad_scrolled),
-        unit_test(insert_single_non_wide_last_column),
-        unit_test(insert_many_non_wide_last_column),
-
-        unit_test(ctrl_left_when_no_input),
-        unit_test(ctrl_left_when_at_start),
-        unit_test(ctrl_left_when_in_first_word),
-        unit_test(ctrl_left_when_in_first_space),
-        unit_test(ctrl_left_when_at_start_of_second_word),
-        unit_test(ctrl_left_when_in_second_word),
-        unit_test(ctrl_left_when_at_end_of_second_word),
-        unit_test(ctrl_left_when_in_second_space),
-        unit_test(ctrl_left_when_at_start_of_third_word),
-        unit_test(ctrl_left_when_in_third_word),
-        unit_test(ctrl_left_when_at_end_of_third_word),
-        unit_test(ctrl_left_when_in_third_space),
-        unit_test(ctrl_left_when_at_end),
-        unit_test(ctrl_left_when_in_only_whitespace),
-        unit_test(ctrl_left_when_start_whitespace_start_of_word),
-        unit_test(ctrl_left_when_start_whitespace_middle_of_word),
-        unit_test(ctrl_left_in_whitespace_between_words),
-        unit_test(ctrl_left_in_whitespace_between_words_start_of_word),
-        unit_test(ctrl_left_in_whitespace_between_words_middle_of_word),
-        unit_test(ctrl_left_when_word_overrun_to_left),
-
-        unit_test(ctrl_right_when_no_input),
-        unit_test(ctrl_right_when_at_end),
-        unit_test(ctrl_right_one_word_at_start),
-        unit_test(ctrl_right_one_word_in_middle),
-        unit_test(ctrl_right_one_word_at_end),
-        unit_test(ctrl_right_two_words_from_middle_first),
-        unit_test(ctrl_right_two_words_from_end_first),
-        unit_test(ctrl_right_two_words_from_space),
-        unit_test(ctrl_right_two_words_from_start_second),
-        unit_test(ctrl_right_one_word_leading_whitespace),
-        unit_test(ctrl_right_two_words_in_whitespace),
-        unit_test(ctrl_right_trailing_whitespace_from_middle),
     };
 
     return run_tests(all_tests);
=hlt&id=36b927a63cb25e9fc64cf4ae079b32d23d528b1b'>^
32b8fac2 ^
0ca56ed8 ^
32b8fac2 ^


0ca56ed8 ^
32b8fac2 ^
76755b28 ^

672e3e50 ^
0ca56ed8 ^








672e3e50 ^
32b8fac2 ^
0ca56ed8 ^























672e3e50 ^





a654e4ec ^
4690ce81 ^
0ca56ed8 ^



65361948 ^
0ca56ed8 ^
672e3e50 ^


0ca56ed8 ^


32b8fac2 ^















c842d90b ^
32b8fac2 ^

2f02189d ^
32b8fac2 ^
44c1aeef ^





2f02189d ^
32b8fac2 ^


2f02189d ^
32b8fac2 ^
2f02189d ^
32b8fac2 ^





2f02189d ^
32b8fac2 ^







2f02189d ^
32b8fac2 ^





2f02189d ^
32b8fac2 ^





44c1aeef ^
32b8fac2 ^
44c1aeef ^
32b8fac2 ^

2f02189d ^
32b8fac2 ^






2f02189d ^
32b8fac2 ^













2f02189d ^
32b8fac2 ^








2f02189d ^
32b8fac2 ^











2f02189d ^
32b8fac2 ^






















0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^



cd9bb850 ^

0ca56ed8 ^







cd9bb850 ^

0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^


cd9bb850 ^
0ca56ed8 ^

cd9bb850 ^


0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^

0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^


0ca56ed8 ^
cd9bb850 ^




0ca56ed8 ^
cd9bb850 ^




0ca56ed8 ^


cd9bb850 ^



0ca56ed8 ^


cd9bb850 ^


0ca56ed8 ^

cd9bb850 ^


0ca56ed8 ^



cd9bb850 ^
0ca56ed8 ^
cd9bb850 ^



0ca56ed8 ^












672e3e50 ^
0ca56ed8 ^












































4690ce81 ^
cd9bb850 ^
0ca56ed8 ^


672e3e50 ^
4690ce81 ^
0ca56ed8 ^
672e3e50 ^
65361948 ^
0ca56ed8 ^
cd9bb850 ^
0ca56ed8 ^
65361948 ^
0ca56ed8 ^

672e3e50 ^


0ca56ed8 ^
672e3e50 ^
0ca56ed8 ^
672e3e50 ^

0ca56ed8 ^
672e3e50 ^
0ca56ed8 ^
76755b28 ^
0ca56ed8 ^
4690ce81 ^
0ca56ed8 ^
9542bb11 ^

4690ce81 ^
0ca56ed8 ^
9542bb11 ^

76755b28 ^


0ca56ed8 ^
4690ce81 ^
2f02189d ^
9542bb11 ^

672e3e50 ^
0ca56ed8 ^

672e3e50 ^



0ca56ed8 ^
a654e4ec ^
4690ce81 ^
cd9bb850 ^
0ca56ed8 ^

cd9bb850 ^
a654e4ec ^
cd9bb850 ^
0ca56ed8 ^


cd9bb850 ^
0ca56ed8 ^
672e3e50 ^



cd9bb850 ^

65361948 ^


76755b28 ^

4690ce81 ^
76755b28 ^

cd9bb850 ^

65361948 ^
4690ce81 ^
a654e4ec ^
4690ce81 ^
65361948 ^
65361948 ^
cd9bb850 ^
65361948 ^


65361948 ^
a654e4ec ^

4690ce81 ^
65361948 ^

4690ce81 ^
65361948 ^



d990e8f0 ^

























0ca56ed8 ^
d990e8f0 ^



















0ca56ed8 ^

























672e3e50 ^


a654e4ec ^
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640