Example #1
0
static void test_set_deta(size_t i, double deta)
{
	set_deta(i, deta);
	assert_false(catdist1_check(&CATDIST1));
	test_ncat();
	test_eta();
}
Example #2
0
int main(void) {
	test_ncpy("");
	test_ncpy("a");
	test_ncpy("ab");
	test_ncpy("abcdefghijklmnopqrstuvwxyz");     /* longer than MAX_BUF */
	
	test_ncat("", "a");
	test_ncat("a", "bc");
	test_ncat("ab", "cde");
	test_ncat("ab", "cdefghijklmnopqrstuvwxyz"); /* longer than MAX_BUF */

	test_ncmp("", "");
	test_ncmp("", "a");
	test_ncmp("a", "a");
	test_ncmp("a", "ab");
	test_ncmp("abc", "ab");

	printf("All tests pass.\n");
	return 0;
}
Example #3
0
static void test_many_set_deta(double min, double max)
{
	size_t n = catdist1_ncat(&CATDIST1);
	size_t iz, nz = 5 * (rand() % n);

	for (iz = 0; iz < nz; iz++) {
		size_t i = rand() % n;
		double deta = runif(min, max);
		set_deta(i, deta);
	}

	assert_false(catdist1_check(&CATDIST1));
	test_ncat();
	test_eta();
}