Anyone else working on Google Test? I managed to get a Google Test sample unit test running with our library of functions. I've only tested creating a webvtt string and parsing a sample .vtt file and simply checking if the functions return WEBVTT_SUCCESS:
. I've also discovered this blog post about unit testing with C code using the Google Test framework that details a number of issues with C unit testing, hopefully they won't cause complications:
.
I used our MSVC build, I have no idea how Google Test would be implemented with our autotools process. A library file has to be created, so as far as I can understand, either all of the Google Test source code would have to be placed in our repo, or a precompiled library file has to be added to our repo. In any case, I've thrown the gtest header files into the ./include directory.
I've pushed my work into tci-gtest, but I've made a few significant changes in the MSVC parsevtt project: I've added gtestd.lib to Linker -> Input -> Additional Dependencies. I've added a precompiled gtestd.lib file to ./test/unit, which must be copied to ./lib. I've surrounded parsevtt_main.c's main with #ifndef TESTING and excluded it from the current MSVC project. The unit_test.cpp uses main() to run unit tests, so it includes parsevtt_main.c to get its functions and defines TESTING to ensure there are no conflicts with multiple main() definitions. I guess a separate project could just be made for Google unit testing instead of including/excluding the parsevtt_main.c file from the project...