netlist: Add `tedax' backend
[geda-gaf.git] / tests / storage / Setup.h
blobbd400378c7f1a173be47327f2d5acf8badb2a379
1 /* Copyright (C) 2013-2017 Roland Lutz
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software Foundation,
15 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 #include <xornstorage.h>
18 #include <assert.h>
19 #include <string.h>
21 static struct xornsch_line line_data;
22 static struct xornsch_box box_data;
23 static struct xornsch_circle circle_data;
24 static struct xornsch_net net_data;
27 static void setup(
28 xorn_revision_t *rev0, xorn_revision_t *rev1,
29 xorn_revision_t *rev2, xorn_revision_t *rev3,
30 xorn_object_t *ob0, xorn_object_t *ob1a, xorn_object_t *ob1b)
32 *rev0 = xorn_new_revision(NULL);
33 assert(*rev0 != NULL);
34 xorn_finalize_revision(*rev0);
36 /* first change */
38 *rev1 = xorn_new_revision(*rev0);
39 assert(*rev1 != NULL);
41 memset(&line_data, 0, sizeof line_data);
42 line_data.pos.x = 0;
43 line_data.pos.y = 1;
44 line_data.size.x = 3;
45 line_data.size.y = 2;
46 line_data.color = 3;
47 line_data.line.width = 1;
49 *ob0 = xornsch_add_line(*rev1, &line_data, NULL);
50 assert(*ob0 != NULL);
52 xorn_finalize_revision(*rev1);
54 /* second change */
56 *rev2 = xorn_new_revision(*rev1);
57 assert(*rev2 != NULL);
59 memset(&box_data, 0, sizeof box_data);
60 box_data.pos.x = 1;
61 box_data.pos.y = 1;
62 box_data.size.x = 2;
63 box_data.size.y = 2;
64 box_data.color = 3;
65 box_data.line.width = 1;
67 *ob1a = xornsch_add_box(*rev2, &box_data, NULL);
68 assert(*ob1a != NULL);
70 memset(&circle_data, 0, sizeof circle_data);
71 circle_data.pos.x = -1;
72 circle_data.pos.y = -1;
73 circle_data.radius = 2;
74 circle_data.color = 3;
75 circle_data.line.width = 1;
76 circle_data.fill.type = 1;
78 *ob1b = xornsch_add_circle(*rev2, &circle_data, NULL);
79 assert(*ob1b != NULL);
81 xorn_finalize_revision(*rev2);
83 /* third change */
85 *rev3 = xorn_new_revision(*rev2);
86 assert(*rev3 != NULL);
88 memset(&net_data, 0, sizeof net_data);
89 net_data.pos.x = 0;
90 net_data.pos.y = 1;
91 net_data.size.x = 3;
92 net_data.size.y = 2;
93 net_data.color = 4;
95 assert(xornsch_set_net_data(*rev3, *ob0, &net_data, NULL) == 0);
97 assert(xorn_delete_object(*rev3, *ob1a, NULL) == 0);
99 xorn_finalize_revision(*rev3);