source: trunk/src/cutest_slib.c@ 157

Last change on this file since 157 was 21, checked in by katerina, 19 years ago

Add some test files.

File size: 552 bytes
Line 
1
2#include "config_xor.h"
3
4#include <string.h>
5#include "CuTest.h"
6#include "samhain.h"
7
8void Test_sl_snprintf (CuTest *tc) {
9
10 int ret = 0;
11 char input[16];
12
13 memset (&input, 'X', 16);
14 ret = sl_snprintf(input, 10, "%s\n", "01234567890123456789");
15 CuAssertIntEquals(tc, ret, 0);
16 CuAssertTrue(tc, input[9] == '\0');
17 CuAssertTrue(tc, input[10] == 'X');
18
19 memset (&input, 'X', 16);
20 ret = sl_snprintf(input, 4, "%d\n", "012345");
21 CuAssertIntEquals(tc, ret, 0);
22 CuAssertTrue(tc, input[3] == '\0');
23 CuAssertTrue(tc, input[4] == 'X');
24}
25
26
Note: See TracBrowser for help on using the repository browser.