ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
semtable_spec.h
Go to the documentation of this file.
1 
7 #include "../src/semtable.h"
8 #include "../src/receptor.h"
9 
12  SemTable *sem = _sem_new();
13  spec_is_equal(sem->contexts,0);
14  int idx = _sem_new_context(sem,(T *)1234L);
15  spec_is_equal(idx,0);
16  spec_is_equal(sem->contexts,1);
17  Symbol s = {SYS_CONTEXT,0,0};
18  spec_is_long_equal((long)_sem_context(sem,s)->definitions,1234L);
19  _sem_free(sem);
21 }
22 
25  spec_is_str_equal(_sem_get_name(G_sem,TEST_INT_SYMBOL),"TEST_INT_SYMBOL");
26  spec_is_str_equal(_sem_get_name(G_sem,NULL_SYMBOL),"NULL_SYMBOL");
27  spec_is_str_equal(_sem_get_name(G_sem,NULL_STRUCTURE),"NULL_STRUCTURE");
28  spec_is_str_equal(_sem_get_name(G_sem,NULL_PROCESS),"NULL_PROCESS");
29  spec_is_str_equal(_sem_get_name(G_sem,DEFINITIONS),"DEFINITIONS");
30  spec_is_str_equal(_sem_get_name(G_sem,INTEGER),"INTEGER");
31  spec_is_str_equal(_sem_get_name(G_sem,IF),"IF");
33 }
34 
37  spec_is_str_equal(t2s(_sem_get_label(G_sem,CONTENT_TYPE,HTTP_HEADER_LABEL)),"(HTTP_HEADER_LABEL:Content-Type)");
38  spec_is_str_equal(t2s(_sem_get_label(G_sem,CONTENT_TYPE,TEST_SYMBOL_SYMBOL)),"(ENGLISH_LABEL:CONTENT_TYPE)");
40 }
41 
44  spec_is_structure_equal(0,_sem_get_symbol_structure(G_sem,STRUCTURE_DEFINITION),TUPLE_OF_STRUCTURE_LABEL_AND_STRUCTURE_DEF);
45  spec_is_structure_equal(0,_sem_get_symbol_structure(G_sem,STRUCTURE_SYMBOL),SYMBOL);
46 
48 }
49 
52  SemanticID s;
53 
54  spec_is_true(__sem_get_by_label(G_sem,"DEFINITIONS",&s,SYS_CONTEXT));
55  spec_is_sem_equal(s,DEFINITIONS);
56  spec_is_false(__sem_get_by_label(G_sem,"DEFINITIONS",&s,INTERNET_CONTEXT));
57 
58  spec_is_true(_sem_get_by_label(G_sem,"OCTET_STREAM",&s));
59  spec_is_sem_equal(s,OCTET_STREAM);
60  spec_is_true(semeq(s,OCTET_STREAM));
61 
62  spec_is_false(_sem_get_by_label(G_sem,"non existent symbol",&s));
63 
65 }
66 
69  _sem_add_label(G_sem,BIT,ASCII_STR,"one or zero");
70  spec_is_str_equal(t2s(_sem_get_def(G_sem,BIT)),"(STRUCTURE_DEFINITION (STRUCTURE_LABEL (ENGLISH_LABEL:BIT) (ASCII_STR:one or zero)) (STRUCTURE_SYMBOL:NULL_SYMBOL))");
72 }
73 
74 void testSemTable() {
81 }
char * _sem_get_name(SemTable *sem, SemanticID s)
Definition: semtable.c:85
Definition: ceptr_types.h:114
void testSemTableGetLabel()
Definition: semtable_spec.h:35
void testSemAddLabel()
Definition: semtable_spec.h:67
T * _sem_get_label(SemTable *sem, SemanticID s, Symbol label_type)
Definition: semtable.c:124
void testSemTableGetName()
Definition: semtable_spec.h:23
void testSemTableCreate()
Definition: semtable_spec.h:10
Definition: ceptr_types.h:51
void testSemGetByLabel()
Definition: semtable_spec.h:50
void testSemGetSymbolStructure()
Definition: semtable_spec.h:42
void _sem_add_label(SemTable *sem, SemanticID s, Symbol label_type, char *label)
Definition: semtable.c:148