File: str.c

package info (click to toggle)
labwc 0.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,856 kB
  • sloc: ansic: 32,546; perl: 5,834; xml: 886; sh: 162; python: 131; makefile: 12
file content (28 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <cmocka.h>
#include "common/string-helpers.h"

static void
test_str_starts_with(void **state)
{
	(void)state;

	assert_true(str_starts_with("  foo", 'f', " \t\r\n"));
	assert_true(str_starts_with("f", 'f', " \t\r\n"));
	assert_false(str_starts_with("  foo", '<', " "));
}

int main(int argc, char **argv)
{
	const struct CMUnitTest tests[] = {
		cmocka_unit_test(test_str_starts_with),
	};

	return cmocka_run_group_tests(tests, NULL, NULL);
}