Files
Toy/test/test_literal_dictionary.c
Kayne Ruse 2e2bee4fa3 Renemed all variables to fit into a namespace
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.
2023-01-25 12:55:55 +00:00

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;
}