| File tests/undo/suite.c changed (mode: 100644) (index 60aa1deed..d8e262caa) |
| 1 |
1 |
#include <stic.h> |
#include <stic.h> |
| 2 |
2 |
|
|
| 3 |
|
#include <assert.h> |
|
| 4 |
3 |
#include <stddef.h> |
#include <stddef.h> |
| 5 |
4 |
|
|
| 6 |
5 |
#include "../../src/ops.h" |
#include "../../src/ops.h" |
| |
| ... |
... |
DEFINE_SUITE(); |
| 17 |
16 |
SETUP() |
SETUP() |
| 18 |
17 |
{ |
{ |
| 19 |
18 |
static int undo_levels = 10; |
static int undo_levels = 10; |
| 20 |
|
int ret_code; |
|
| 21 |
19 |
|
|
| 22 |
20 |
init_undo_list_for_tests(&exec_func, &undo_levels); |
init_undo_list_for_tests(&exec_func, &undo_levels); |
| 23 |
21 |
|
|
| 24 |
22 |
un_group_open("msg1"); |
un_group_open("msg1"); |
| 25 |
|
ret_code = un_group_add_op(OP_MOVE, NULL, NULL, "do_msg1", "undo_msg1"); |
|
| 26 |
|
assert(ret_code == 0); |
|
|
23 |
|
assert_success(un_group_add_op(OP_MOVE, NULL, NULL, "do_msg1", "undo_msg1")); |
| 27 |
24 |
un_group_close(); |
un_group_close(); |
| 28 |
25 |
|
|
| 29 |
26 |
un_group_open("msg2"); |
un_group_open("msg2"); |
| 30 |
|
ret_code = un_group_add_op(OP_MOVE, NULL, NULL, "do_msg2_cmd1", |
|
| 31 |
|
"undo_msg2_cmd1"); |
|
| 32 |
|
assert(ret_code == 0); |
|
| 33 |
|
ret_code = un_group_add_op(OP_MOVE, NULL, NULL, "do_msg2_cmd2", |
|
| 34 |
|
"undo_msg2_cmd2"); |
|
| 35 |
|
assert(ret_code == 0); |
|
|
27 |
|
assert_success(un_group_add_op(OP_MOVE, NULL, NULL, "do_msg2_cmd1", |
|
28 |
|
"undo_msg2_cmd1")); |
|
29 |
|
assert_success(un_group_add_op(OP_MOVE, NULL, NULL, "do_msg2_cmd2", |
|
30 |
|
"undo_msg2_cmd2")); |
| 36 |
31 |
un_group_close(); |
un_group_close(); |
| 37 |
32 |
|
|
| 38 |
33 |
un_group_open("msg3"); |
un_group_open("msg3"); |
| 39 |
|
ret_code = un_group_add_op(OP_MOVE, NULL, NULL, "do_msg3", "undo_msg3"); |
|
| 40 |
|
assert(ret_code == 0); |
|
|
34 |
|
assert_success(un_group_add_op(OP_MOVE, NULL, NULL, "do_msg3", "undo_msg3")); |
| 41 |
35 |
un_group_close(); |
un_group_close(); |
| 42 |
36 |
} |
} |
| 43 |
37 |
|
|