netlist: Add `tedax' backend
[geda-gaf.git] / tests / storage / get_objects.c
blobdb6064017203e1a50c671a1a2e51d686fc75cbcf
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 "Setup.h"
18 #include <stdlib.h>
21 int main(void)
23 xorn_revision_t rev0, rev1, rev2, rev3;
24 xorn_object_t ob0, ob1a, ob1b;
26 xorn_object_t *objects;
27 size_t count;
29 setup(&rev0, &rev1, &rev2, &rev3, &ob0, &ob1a, &ob1b);
31 assert(xorn_get_objects(rev0, &objects, &count) == 0);
32 assert(count == 0);
33 free(objects);
35 assert(xorn_get_objects(rev1, &objects, &count) == 0);
36 assert(objects != NULL);
37 assert(count == 1);
38 assert(objects[0] == ob0);
39 free(objects);
41 assert(xorn_get_objects(rev2, &objects, &count) == 0);
42 assert(objects != NULL);
43 assert(count == 3);
44 assert(objects[0] == ob0);
45 assert(objects[1] == ob1a);
46 assert(objects[2] == ob1b);
47 free(objects);
49 assert(xorn_get_objects(rev3, &objects, &count) == 0);
50 assert(objects != NULL);
51 assert(count == 2);
52 assert(objects[0] == ob0);
53 assert(objects[1] == ob1b);
54 free(objects);
56 xorn_free_revision(rev3);
57 xorn_free_revision(rev2);
58 xorn_free_revision(rev1);
59 xorn_free_revision(rev0);
60 return 0;