1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<meta name="generator" content="AsciiDoc 8.2.1" />
7
<style type="text/css">
9
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11
border: 1px solid red;
16
margin: 1em 5% 1em 5%;
21
text-decoration: underline;
39
h1, h2, h3, h4, h5, h6 {
41
font-family: sans-serif;
48
border-bottom: 2px solid silver;
51
border-bottom: 2px solid silver;
61
border: 1px solid silver;
76
font-family: sans-serif;
83
font-family: sans-serif;
87
font-family: sans-serif;
89
border-top: 2px solid silver;
95
padding-bottom: 0.5em;
99
padding-bottom: 0.5em;
103
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
104
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
105
div.admonitionblock {
108
margin-bottom: 1.5em;
110
div.admonitionblock {
112
margin-bottom: 2.5em;
115
div.content { /* Block element content. */
119
/* Block element titles. */
120
div.title, caption.title {
121
font-family: sans-serif;
125
margin-bottom: 0.5em;
131
td div.title:first-child {
134
div.content div.title:first-child {
137
div.content + div.title {
141
div.sidebarblock > div.content {
143
border: 1px solid silver;
150
div.listingblock > div.content {
151
border: 1px solid silver;
156
div.quoteblock > div.content {
163
div.verseblock + div.attribution {
167
div.admonitionblock .icon {
171
text-decoration: underline;
173
padding-right: 0.5em;
175
div.admonitionblock td.content {
177
border-left: 2px solid silver;
180
div.exampleblock > div.content {
181
border-left: 2px solid silver;
185
div.verseblock div.content {
189
div.imageblock div.content { padding-left: 0; }
190
div.imageblock img { border: 1px solid silver; }
191
span.image img { border-style: none; }
195
margin-bottom: 0.8em;
207
list-style-position: outside;
210
list-style-type: lower-alpha;
213
div.tableblock > table {
214
border: 3px solid #527bbd;
217
font-family: sans-serif;
226
margin-bottom: 0.8em;
234
padding-right: 0.8em;
241
div#footer-badges { display: none; }
246
font-family: sans-serif;
250
margin-bottom: 0.1em;
253
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
269
/* Workarounds for IE6's broken and incomplete CSS2. */
271
div.sidebar-content {
273
border: 1px solid silver;
276
div.sidebar-title, div.image-title {
277
font-family: sans-serif;
280
margin-bottom: 0.5em;
283
div.listingblock div.content {
284
border: 1px solid silver;
289
div.quoteblock-content {
293
div.exampleblock-content {
294
border-left: 2px solid silver;
298
/* IE6 sets dynamically generated links as visited. */
299
div#toc a:visited { color: blue; }
301
<title>Unit tests for C</title>
305
<h1>Unit tests for C</h1>
308
<div class="sectionbody">
309
<p>The <tt>sigscheme/test-c/</tt> directory is existing for unit testing for C. The tests
310
are currently using our own testing framework. See test-c/README for further
313
<h2>2. Requirements for testing framework</h2>
314
<div class="sectionbody">
315
<p>I had tried to use the famous <a href="http://cunit.sf.net/">CUnit</a> at first to test
316
SigScheme, but it did not met my requirements and needs long way to modify to
317
fit to SigScheme. So I searched for other testing frameworks and once decided
319
<a href="http://www.cozmixng.org/~rwiki/?cmd=view;name=Cutter%3A%3AREADME.en">Cutter</a>.
320
Please let me know better solutions if you know.</p>
329
To avoid C++-specific interferences especially stacks, frames
330
and exceptions with GC
335
To allow running tests on platforms that has poor or no C++ support
342
Don't terminate a test even if an assertion is failed
347
Prints the expected and actual values when an assertion failed, as follows
351
<div class="listingblock">
352
<div class="content">
353
<pre><tt>./test_format.c:64: - format ~D -
355
but was: <2147483647></tt></pre>
360
Standalone test runner
362
<div class="literalblock">
363
<div class="content">
364
<pre><tt>i.e. There is no need to write the main function for each test.</tt></pre>
369
Automatic testsuite configuration
371
<div class="literalblock">
372
<div class="content">
373
<pre><tt>i.e. There is no need to register all tests into a testsuite by hand.</tt></pre>
378
It can be inserted SCM_GC_PROTECTED_CALL() on each tests
382
<p>And some recommendations:</p>
391
Assertions macro names are short
396
Assertions have assert(expected, actual) form instead of
397
assert(actual, expected)
403
<div id="footer-text">
404
Last updated 20-Feb-2008 21:35:22 JST