Reworking structures for easy testing, read more

I was reworking bits of the containers to address issue #131, then
realized that the table's tests depended on a specific initial size. I'm
too buggered to finish it tonight, so I'll fix it tomorrow.
This commit is contained in:
2024-10-18 20:48:33 +11:00
parent c3ee92fcef
commit 98ea0e5884
11 changed files with 115 additions and 57 deletions

View File

@@ -16,3 +16,20 @@ TOY_API void Toy_pushStack(Toy_Stack** stackHandle, Toy_Value value);
TOY_API Toy_Value Toy_peekStack(Toy_Stack** stackHandle);
TOY_API Toy_Value Toy_popStack(Toy_Stack** stackHandle);
//some useful sizes, could be swapped out as needed
#ifndef TOY_STACK_INITIAL_CAPACITY
#define TOY_STACK_INITIAL_CAPACITY 8
#endif
#ifndef TOY_STACK_EXPANSION_RATE
#define TOY_STACK_EXPANSION_RATE 2
#endif
#ifndef TOY_STACK_CONTRACTION_RATE
#define TOY_STACK_CONTRACTION_RATE (1 / 4)
#endif
//prevent an infinite expansion, limited to 1MB
#ifndef TOY_STACK_OVERFLOW
#define TOY_STACK_OVERFLOW (1024 * 1024 / sizeof(Toy_Value))
#endif