コード例 #1
0
int main()
{
    test_blank();
    test_ordinary();
    test_invalid();
    return 0;
}
コード例 #2
0
ファイル: test-rem.c プロジェクト: kusumi/DragonFlyBSD
int
main(int argc, char *argv[])
{

	printf("1..3\n");

	test_invalid(0.0, 0.0);
	test_invalid(1.0, 0.0);
	test_invalid(INFINITY, 0.0);
	test_invalid(INFINITY, 1.0);
	test_invalid(-INFINITY, 1.0);
	test_invalid(NAN, 1.0);
	test_invalid(1.0, NAN);

	test(4, 4, 0, 1);
	test(0, 3.0, 0, 0);
	testd(0x1p-1074, 1, 0x1p-1074, 0);
	testf(0x1p-149, 1, 0x1p-149, 0);
	test(3.0, 4, -1, 1);
	test(3.0, -4, -1, -1);
	testd(275 * 1193040, 275, 0, 1193040);
	test(4.5 * 7.5, 4.5, -2.25, 8);	/* we should get the even one */
	testf(0x1.9044f6p-1, 0x1.ce662ep-1, -0x1.f109cp-4, 1);
#if LDBL_MANT_DIG > 53
	testl(-0x1.23456789abcdefp-2000L, 0x1.fedcba987654321p-2000L,
	      0x1.b72ea61d950c862p-2001L, -1);
#endif

	printf("ok 1 - rem\n");

	/*
	 * The actual quotient here is 864062210.50000003..., but
	 * double-precision division gets -8.64062210.5, which rounds
	 * the wrong way.  This test ensures that remquo() is smart
	 * enough to get the low-order bit right.
	 */
	testd(-0x1.98260f22fc6dep-302, 0x1.fb3167c430a13p-332,
	    0x1.fb3165b82de72p-333, -864062211);
	/* Even harder cases with greater exponent separation */
	test(0x1.fp100, 0x1.ep-40, -0x1.cp-41, 143165577);
	testd(-0x1.abcdefp120, 0x1.87654321p-120,
	    -0x1.69c78ec4p-121, -63816414);

	printf("ok 2 - rem\n");

	test(0x1.66666cp+120, 0x1p+71, 0.0, 1476395008);
	testd(-0x1.0000000000003p+0, 0x1.0000000000003p+0, -0.0, -1);
	testl(-0x1.0000000000003p+0, 0x1.0000000000003p+0, -0.0, -1);
	testd(-0x1.0000000000001p-749, 0x1.4p-1072, 0x1p-1074, -1288490189);
	testl(-0x1.0000000000001p-749, 0x1.4p-1072, 0x1p-1074, -1288490189);

	printf("ok 3 - rem\n");

	return (0);
}
コード例 #3
0
ファイル: fileio.c プロジェクト: AndrewD/prex
/*
 * Main routine
 */
int
main(int argc, char *argv[])
{
	char test_str[] = "test stdout...\n\n";

	syslog(LOG_INFO, "\nfileio: fs test program\n");

	/* Wait 1 sec until loading fs server */
	timer_sleep(1000, 0);

	/*
	 * Prepare to use a file system.
	 */
	fslib_init();

	/*
	 * Mount file systems
	 */
	mount("", "/", "ramfs", 0, NULL);
	mkdir("/dev", 0);
	mount("", "/dev", "devfs", 0, NULL);		/* device */
	mkdir("/boot", 0);
	mount("/dev/ram0", "/boot", "arfs", 0, NULL);	/* archive */
	mkdir("/tmp", 0);
	/*
	 * Prepare stdio
	 */
	open("/dev/tty", O_RDWR);	/* stdin */
	dup(0);				/* stdout */
	dup(0);				/* stderr */

	/* Test device write */
	write(STDOUT_FILENO, test_str, strlen(test_str));

	test_write();

	cat_file();		/* test read/write */

	test_invalid();		/* test invalid request */

	test_read();		/* test read loop */

	test_open();		/* test open/close loop */

	/*
	 * Disconnect from a file system.
	 */
	fslib_exit();
	return 0;
}
コード例 #4
0
ファイル: CodexTest.cpp プロジェクト: atyenoria/skia
DEF_TEST(Codec_Empty, r) {
    // Test images that should not be able to create a codec
    test_invalid(r, "empty_images/zero-dims.gif");
    test_invalid(r, "empty_images/zero-embedded.ico");
    test_invalid(r, "empty_images/zero-width.bmp");
    test_invalid(r, "empty_images/zero-height.bmp");
    test_invalid(r, "empty_images/zero-width.jpg");
    test_invalid(r, "empty_images/zero-height.jpg");
    test_invalid(r, "empty_images/zero-width.png");
    test_invalid(r, "empty_images/zero-height.png");
    test_invalid(r, "empty_images/zero-width.wbmp");
    test_invalid(r, "empty_images/zero-height.wbmp");
    // This image is an ico with an embedded mask-bmp.  This is illegal.
    test_invalid(r, "invalid_images/mask-bmp-ico.ico");
}
コード例 #5
0
ファイル: uri.c プロジェクト: DarkDare/tarantool
int
main(void)
{
	plan(60);

	/* General */
	test("host", NULL, NULL, NULL, "host", NULL, NULL, NULL, NULL, 0);
	test("host/", NULL, NULL, NULL, "host", NULL, "/", NULL, NULL, 0);
	test("host/path1/path2/path3", NULL, NULL, NULL, "host", NULL,
	     "/path1/path2/path3", NULL, NULL, 0);
	test("host/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL,
	     NULL, "host", NULL, "/path1/path2/path3",
	     "q1=v1&q2=v2", "fragment", 0);

	test("host:service", NULL, NULL, NULL, "host", "service", NULL, NULL,
	     NULL, 0);

	test("host:service/", NULL, NULL, NULL, "host", "service", "/", NULL,
	     NULL, 0);

	test("host:service/path1/path2/path3", NULL, NULL, NULL, "host",
	     "service", "/path1/path2/path3", NULL, NULL, 0);
	test("host:service/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL,
	     NULL, "host", "service", "/path1/path2/path3",
	     "q1=v1&q2=v2", "fragment", 0);

	test("login@host", NULL, "login", NULL, "host", NULL, NULL, NULL,
	     NULL, 0);
	test("login@host/", NULL, "login", NULL, "host", NULL, "/", NULL,
	     NULL, 0);
	test("login@host/path1/path2/path3", NULL, "login", NULL, "host", NULL,
	     "/path1/path2/path3", NULL, NULL, 0);
	test("login@host/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, "login",
	     NULL, "host", NULL, "/path1/path2/path3",
	     "q1=v1&q2=v2", "fragment", 0);

	test("login:password@host", NULL, "login", "password", "host", NULL,
	     NULL, NULL, NULL, 0);
	test("login:password@host/", NULL, "login", "password", "host", NULL,
	     "/", NULL, NULL, 0);
	test("login:password@host/path1/path2/path3", NULL, "login", "password",
	     "host", NULL, "/path1/path2/path3", NULL, NULL, 0);
	test("login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment",
	     NULL, "login", "password", "host", NULL, "/path1/path2/path3",
	     "q1=v1&q2=v2", "fragment", 0);

	test("login:password@host:service", NULL, "login", "password", "host",
	     "service", NULL, NULL, NULL, 0);
	test("login:password@host:service/", NULL, "login", "password", "host",
	     "service", "/", NULL, NULL, 0);
	test("login:password@host:service/path1/path2/path3", NULL, "login",
	     "password", "host", "service", "/path1/path2/path3", NULL,
	     NULL, 0);
	test("login:password@host:service/path1/path2/path3?q1=v1&q2=v2"
	     "#fragment", NULL, "login", "password", "host", "service",
	     "/path1/path2/path3", "q1=v1&q2=v2", "fragment", 0);

	test("scheme://*****:*****@host:service", "scheme", "login",
	     "password", "host", "service", NULL, NULL, NULL, 0);
	test("scheme://*****:*****@host:service/", "scheme", "login",
	     "password", "host", "service", "/", NULL, NULL, 0);
	test("scheme://*****:*****@host:service/path1/path2/path3", "scheme",
	     "login", "password", "host", "service", "/path1/path2/path3",
	     NULL, NULL, 0);
	test("scheme://*****:*****@host:service/path1/path2/path3?"
	     "q1=v1&q2=v2#fragment", "scheme", "login", "password", "host",
	     "service", "/path1/path2/path3", "q1=v1&q2=v2", "fragment", 0);

	test("host/path", NULL, NULL, NULL, "host", NULL, "/path", NULL,
	     NULL, 0);
	test("host//", NULL, NULL, NULL, "host", NULL, "//", NULL, NULL, 0);
	test("host//path", NULL, NULL, NULL, "host", NULL, "//path", NULL,
	     NULL, 0);
	test("host/;abc?q", NULL, NULL, NULL, "host", NULL, "/;abc", "q",
	     NULL, 0);

	test("scheme://*****:*****@host:service/@path1/:path2?"
	     "q1=v1&q2=v2#fragment", "scheme", "login", "password", "host",
	     "service", "/@path1/:path2", "q1=v1&q2=v2", "fragment", 0);
	test("host/~user", NULL, NULL, NULL, "host", NULL, "/~user", NULL,
	     NULL, 0);

	/* Host */
	test("try.tarantool.org", NULL, NULL, NULL, "try.tarantool.org", NULL,
	     NULL, NULL, NULL, 0);

	test("try.tarantool.org", NULL, NULL, NULL, "try.tarantool.org", NULL,
	     NULL, NULL, NULL, 0);

	test("www.llanfairpwllgwyngyllgogerychwyrndrobwyll-"
	     "llantysiliogogogoch.com", NULL, NULL, NULL,
	     "www.llanfairpwllgwyngyllgogerychwyrndrobwyll-"
	     "llantysiliogogogoch.com", NULL, NULL, NULL, NULL, 0);

	/* IPv4 / IPv6 addreses */
	test("0.0.0.0", NULL, NULL, NULL, "0.0.0.0", NULL, NULL, NULL, NULL, 1);
	test("127.0.0.1", NULL, NULL, NULL, "127.0.0.1", NULL, NULL, NULL,
	     NULL, 1);
	test("127.0.0.1:3313", NULL, NULL, NULL, "127.0.0.1", "3313", NULL,
	     NULL, NULL, 1);

	test("scheme://*****:*****@127.0.0.1:3313", "scheme", "login",
	     "password", "127.0.0.1", "3313", NULL, NULL, NULL, 1);

	test("[2001::11a3:09d7::1]", NULL, NULL, NULL, "2001::11a3:09d7::1",
	     NULL, NULL, NULL, NULL, 2);
	test("scheme://*****:*****@[2001::11a3:09d7::1]:3313", "scheme",
	     "login", "password", "2001::11a3:09d7::1", "3313", NULL, NULL,
	     NULL, 2);
	test("scheme://[2001:0db8:11a3:09d7::1]", "scheme", NULL, NULL,
	     "2001:0db8:11a3:09d7::1", NULL, NULL, NULL, NULL, 2);

	test("[::ffff:11.2.3.4]", NULL, NULL, NULL, "::ffff:11.2.3.4",
	     NULL, NULL, NULL, NULL, 2);
	test("scheme://*****:*****@[::ffff:11.2.3.4]:3313", "scheme",
	     "login", "password", "::ffff:11.2.3.4", "3313", NULL, NULL,
	     NULL, 2);

	/* Port */
	test("1", NULL, NULL, NULL, NULL, "1", NULL, NULL, NULL, 0);
	test("10", NULL, NULL, NULL, NULL, "10", NULL, NULL, NULL, 0);
	test("331", NULL, NULL, NULL, NULL, "331", NULL, NULL, NULL,0);
	test("3313", NULL, NULL, NULL, NULL, "3313", NULL, NULL, NULL, 0);

	/* Unix */
	test("/", NULL, NULL, NULL, "unix/", "/", NULL, NULL, NULL, 3);
	test("/path1/path2/path3", NULL, NULL, NULL, "unix/",
	     "/path1/path2/path3", NULL, NULL, NULL, 3);
	test("login:password@/path1/path2/path3", NULL, "login", "password",
	     "unix/", "/path1/path2/path3", NULL, NULL, NULL, 3);
	test("unix/:/path1/path2/path3", NULL, NULL, NULL, "unix/",
	     "/path1/path2/path3", NULL, NULL, NULL, 3);
	test("unix/:/path1/path2/path3:", NULL, NULL, NULL, "unix/",
	     "/path1/path2/path3", NULL, NULL, NULL, 3);
	test("unix/:/path1/path2/path3:/", NULL, NULL, NULL, "unix/",
	     "/path1/path2/path3", "/", NULL, NULL, 3);
	test("unix/:/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL, NULL,
	     "unix/", "/path1/path2/path3", NULL, "q1=v1&q2=v2", "fragment", 3);
	test("unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment",
	     NULL, NULL, NULL, "unix/", "/path1/path2/path3", "/p1/p2",
	     "q1=v1&q2=v2", "fragment", 3);
#if 0
	/* Broken due to grammar limitations. */
	test("login:password@unix/:/path1/path2/path3", NULL, "login",
	     "password", "unix/", "/path1/path2/path3", NULL, NULL, NULL, 3);
#endif
	test("scheme://*****:*****@unix/:/tmp/unix.sock:/path1/path2/path3",
	     "scheme", "login", "password", "unix/", "/tmp/unix.sock",
	     "/path1/path2/path3", NULL, NULL, 3);
	test("unix/:./relative/path.sock:/test", NULL, NULL, NULL, "unix/",
	     "./relative/path.sock", "/test", NULL, NULL, 3);
	test("scheme://unix/:./relative/path.sock:/test", "scheme", NULL, NULL,
	     "unix/", "./relative/path.sock", "/test", NULL, NULL, 3);

	/* Web */
	test("http://tarantool.org/dist/master/debian/pool/main/t/tarantool/"
	     "tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz",
	     "http", NULL, NULL, "tarantool.org", NULL,
	     "/dist/master/debian/pool/main/t/tarantool/"
	     "tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz",
	     NULL, NULL, 0);

	test("https://www.google.com/search?"
	     "safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool"
	     "&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl",
	     "https", NULL, NULL, "www.google.com", NULL, "/search",
	     "safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool"
	     "&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl",
	     NULL, 0);

	test_invalid();

	return check_plan();
}