4
我正在尝试运行一些简单的单元测试,用于使用GLib编写的一些C代码。我试着这样做:如何使用GLib框架运行单元测试?
#include <math.h>
#include <stdio.h>
#include <glib.h>
static void
test_stuff()
{
g_assert (1 == 1); //Say
}
int main (int argc, char **argv)
{
g_test_init (&argc, &argv);
g_test_add_func ("/TestTest", test_stuff);
return g_test_run();
}
但是当我编译(说一个叫EXEC二进制),并尝试运行此使用gtester(甚至运行所述直接二进制),我收到以下错误:
[email protected]:tests$ gtester exec
TEST: exec... (pid=6503)
(process:6503): GLib-CRITICAL **: g_test_init: assertion `vararg1 == NULL' failed
FAIL: exec
Terminated
有什么我失踪了,也许我应该通过运行测试的变量?
工作很好!感谢您的快速回复。 – Abenga 2012-08-13 09:34:10
那么,你为什么不接受它作为答案? – Mawg 2015-10-26 15:05:29
@Mawg好问题,〜6年后现在 – sehe 2018-03-01 14:53:33