Compiling the test suite
 

FreeBASIC项目有一套测试,可以确保错误保持死亡,并且新的错误更难获得立足点。测试套件用CUnit库的FreeBASIC端口(Thanks,stylin!)编写。

调用

测试位于FreeBASIC主目录中的tests子目录中。调用make将显示以下帮助文本:


$ make
usage: make target [options]

Targets: (using cunit):
cunit-tests
log-tests
failed-tests
check
mostlyclean
clean

Targets: (bypassing cunit)
log-tests ALLOW_CUNIT=1
failed-tests ALLOW_CUNIT=1
mostlyclean ALLOW_CUNIT=1
clean ALLOW_CUNIT=1

Options:
FBC=/path/fbc
FB_LANG=fb | fblite | qb | deprecated
DEBUG=1
EXTRAERR=1
ARCH=arch (default is 486)
OS=DOS
FPU=fpu | sse

Targets: Configuration and Checks
check

Example: make all available tests
make cunit-tests
make log-tests

Example: make obj -lang qb tests
make log-tests FB_LANG=qb


当您进行调用时,例如:

make cunit-tests && make log-tests

一些初始化的索引文件将会发生,其次是数百个测试的编译。耐心等待运行所有测试可能需要一段时间

如果您收到以下错误消息:FreeBASIC/bin/linux/ld: cannot find -lcunit

这意味着您需要安装cunit库。在Ubuntu上看起来像:

$ sudo apt-get install libcunit1-dev

已知失败

在撰写本文档时,以下测试预计在某些平台上将失败:


Suite fbc_tests.string_.format_, Test number format test had failures:
1. string/format.bas:168 - CU_ASSERT_EQUAL(sWanted,sResult)
2. string/format.bas:168 - CU_ASSERT_EQUAL(sWanted,sResult)
3. string/format.bas:168 - CU_ASSERT_EQUAL(sWanted,sResult)
4. string/format.bas:168 - CU_ASSERT_EQUAL(sWanted,sResult)


所以如果你得到这些失败,一切都是正常的。没有其他测试应该失败,包括日志测试。

感谢您运行测试并为FreeBASIC提供了一个健康的编译器!请报告任何其他失败http://www.freebasic.net/forum,所以我们可以调查。