test_getTypes.c
#include "SDO.h"
#include "assert.h"
// Basic enumeration of all defined types
void test_getTypes() {
SDOFACTORY df = dfAlloc("test");
stypeDefine(df,
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n"
" targetNamespace=\"http://www.example.com\"\n"
" xmlns=\"http://www.example.com\">\n"
" <xsd:simpleType name=\"myType\">\n"
" <xsd:restriction base=\"xsd:string\"/>\n"
" </xsd:simpleType>\n"
"</xsd:schema>\n");
int found = 0;
SDOLIST l = getTypes(df);
for (int i = 0; i < getCountList(l); i++) {
SDOTYPE t = getTypeList(l, i);
if (!strcmp("myType", getTypeName(t))) {
found = 1;
break;
}
}
assert(found);
}