Some Miscellaneous Library Improvements
I’ve been working on my various C/C++ single header libraries some over the Christmas break, and I thought I’d just jot down the improvements I’ve made in a post.
process.h -> subprocess.h⌗
I’ve had a long standing complaint that the name process.h
conflicted with a
Windows system header. I’ve decided (after a good three years of indecision mind
you) to just
rename the header and the entry points
to subprocess.h
instead.
This isn’t a perfect solution, but it avoids me having to namespace my headers using my own name (which as a Scotsman I just can’t quite stomach for some reason).
utest.h⌗
I added the ability to assert/expect on pointers types, which was a longstanding annoyance. So the following now works:
int* a, *b;
ASSERT_EQ(a, b);
I’ve also made it so that on GCC/Clang with C, or with C++11 using auto, you can perform checks on void-pointers, and things of array type:
static int data[42];
void* a;
ASSERT_EQ(a, data);
I also made the testing of the --list-tests
option that was contributed by
ldrumm (which required spawning a
separate process) work on Windows and macOS too by using my
subprocess.h.
I also added a product page for utest.h to help me try and advertise it more greatly for people than before.
utf8.h⌗
I fixed a bug with utf8casecmp
in my UTF-8 parsing library and added some extra tests to stop the regression
happening again.
The ‘bug’ wasn’t really a bug in that the function behaved in a similar
fashion to the specification of the GNU extension strcasecmp
that it is based
on, but it made sense to make utf8casecmp
match what strcasecmp
does.