mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Basically, all Toy varaibles, functions, etc. are prepended with "Toy_", and macros are prepended with "TOY_". This is to reduce namespace pollution, which was an issue pointed out to be - blame @GyroVorbis. I've also bumped the minor version number - theoretically I should bump the major number, but I'm not quite ready for 1.0 yet.
39 lines
846 B
C
39 lines
846 B
C
#include "toy_literal_dictionary.h"
|
|
|
|
#include "toy_memory.h"
|
|
#include "toy_console_colors.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
{
|
|
//test init & cleanup
|
|
Toy_LiteralDictionary dictionary;
|
|
Toy_initLiteralDictionary(&dictionary);
|
|
Toy_freeLiteralDictionary(&dictionary);
|
|
}
|
|
|
|
{
|
|
//test insertion and deletion
|
|
char* idn_raw = "foobar";
|
|
char* str_raw = "hello world";
|
|
|
|
Toy_Literal identifier = TOY_TO_IDENTIFIER_LITERAL(Toy_createRefString(idn_raw));
|
|
Toy_Literal string = TOY_TO_STRING_LITERAL(Toy_createRefString(str_raw));
|
|
|
|
Toy_LiteralDictionary dictionary;
|
|
Toy_initLiteralDictionary(&dictionary);
|
|
|
|
Toy_setLiteralDictionary(&dictionary, identifier, string);
|
|
|
|
Toy_freeLiteral(identifier);
|
|
Toy_freeLiteral(string);
|
|
|
|
Toy_freeLiteralDictionary(&dictionary);
|
|
}
|
|
|
|
printf(TOY_CC_NOTICE "All good\n" TOY_CC_RESET);
|
|
return 0;
|
|
}
|
|
|