예제 #1
0
파일: test.c 프로젝트: unwind/lzjb-stream
int main(int argc, char *argv[])
{
    size_t	i;

    printf("Testing lzjb-stream's size codec API ...\n");
    /* Hard-coded edge cases. */
    test_size(0);
    test_size(~(size_t) 0);
    /* A single walking 1-bit. */
    for(i = 1; i != 0; i <<= 1)
        test_size(i);
    for(i = 0; i < 1000000; ++i)
    {
        test_size(rand());
    }

    printf("Testing lzjb-stream's decompression API ...\n");
    test_decompress();

    printf("%zu/%zu tests passed\n", test_state.pass_count, test_state.count);

    printf("Testing performance ...\n");
    test_performance("performance-data.lzjb");

    printf("By the way, the stream itself is %zu bytes\n", sizeof (LZJBStream));

    return EXIT_SUCCESS;
}
예제 #2
0
int
main()
{
	int failures = 0;

	failures += test_size("sql_tinyint",
			mysqlpp::sql_tinyint(0), 1) == false;
	failures += test_size("sql_tinyint_unsigned",
			mysqlpp::sql_tinyint_unsigned(0), 1) == false;
	failures += test_size("sql_smallint",
			mysqlpp::sql_smallint(0), 2) == false;
	failures += test_size("sql_smallint_unsigned",
			mysqlpp::sql_smallint_unsigned(0), 2) == false;
	failures += test_size("sql_mediumint",
			mysqlpp::sql_mediumint(0), 4) == false;
	failures += test_size("sql_mediumint_unsigned",
			mysqlpp::sql_mediumint_unsigned(0), 4) == false;
	failures += test_size("sql_int",
			mysqlpp::sql_int(0), 4) == false;
	failures += test_size("sql_int_unsigned",
			mysqlpp::sql_int_unsigned(0), 4) == false;
	failures += test_size("sql_bigint",
			mysqlpp::sql_bigint(0), 8) == false;
	failures += test_size("sql_bigint_unsigned",
			mysqlpp::sql_bigint_unsigned(0), 8) == false;
	
	return failures;
}
예제 #3
0
inline mxArray* do_det2x2(const mxArray *mxA)
{    
    int n = 0;
    
    if (test_size(mxA, 2, 2, n))
    {        
        const Mat2x2<T>* A = (const Mat2x2<T>*)mxGetData(mxA);        
        mxArray *mxR = create_mat<T>(1, n);
        T *r = (T*)mxGetData(mxR);    
    
        for (int i = 0; i < n; ++i)
        {
            r[i] = det(A[i]);
        }
        
        return mxR;
    }
    else if (test_size(mxA, 4, 1, n))
    {        
        const Mat2x2<T>* A = (const Mat2x2<T>*)mxGetData(mxA);
        mxArray *mxR = create_mat<T>(1, n);
        T *r = (T*)mxGetData(mxR);   
        
        for (int i = 0; i < n; ++i)
        {
            r[i] = det(A[i]);
        }
        
        return mxR;
    }
    else if (test_size(mxA, 3, 1, n))
    {
        const SMat2x2<T>* A = (const SMat2x2<T>*)mxGetData(mxA);
        mxArray *mxR = create_mat<T>(1, n);
        T *r = (T*)mxGetData(mxR);
        
        for (int i = 0; i < n; ++i)
        {
            r[i] = det(A[i]);
        }
        
        return mxR;
    }
    else
    {
        mexErrMsgIdAndTxt("det2x2:invalidarg", "The size of input array is invalid.");
    }
    
    return NULL;
}
예제 #4
0
inline mxArray* do_sqrtm2x2(const mxArray *mxA)
{
    int n = 0;
    
    if (test_size(mxA, 2, 2, n))
    {        
        const Mat2x2<T>* A = (const Mat2x2<T>*)mxGetData(mxA);
        mxArray *mxR = create_cube<T>(2, 2, n);
        Mat2x2<T>* R = (Mat2x2<T>*)mxGetData(mxR);
        
        for (int i = 0; i < n; ++i)
        {
            sqrtm(A[i], R[i]);
        }
        
        return mxR;
    }
    else if (test_size(mxA, 4, 1, n))
    {        
        const Mat2x2<T>* A = (const Mat2x2<T>*)mxGetData(mxA);
        mxArray *mxR = create_mat<T>(4, n);
        Mat2x2<T>* R = (Mat2x2<T>*)mxGetData(mxR);
        
        for (int i = 0; i < n; ++i)
        {
            sqrtm(A[i], R[i]);
        }
        
        return mxR;
    }
    else if (test_size(mxA, 3, 1, n))
    {
        const SMat2x2<T>* A = (const SMat2x2<T>*)mxGetData(mxA);
        mxArray *mxR = create_mat<T>(3, n);
        SMat2x2<T>* R = (SMat2x2<T>*)mxGetData(mxR);
        
        for (int i = 0; i < n; ++i)
        {
            sqrtm(A[i], R[i]);
        }
        
        return mxR;
    }
    else
    {
        mexErrMsgIdAndTxt("sqrtm2x2:invalidarg", "The size of input array is invalid.");
    }
    
    return NULL;
}
예제 #5
0
int main()
{
	int Error = 0;

	Error += test_member_alloc_bug();
	Error += test_ctr();

	Error += test_operators<glm::mat4, glm::vec4>();
	Error += test_operators<glm::lowp_mat4, glm::lowp_vec4>();
	Error += test_operators<glm::mediump_mat4, glm::mediump_vec4>();
	Error += test_operators<glm::highp_mat4, glm::highp_vec4>();

	Error += test_operators<glm::dmat4, glm::dvec4>();
	Error += test_operators<glm::lowp_dmat4, glm::lowp_dvec4>();
	Error += test_operators<glm::mediump_dmat4, glm::mediump_dvec4>();
	Error += test_operators<glm::highp_dmat4, glm::highp_dvec4>();

	Error += test_inverse<glm::mat4>();
	Error += test_inverse<glm::lowp_mat4>();
	Error += test_inverse<glm::mediump_mat4>();
	Error += test_inverse<glm::highp_mat4>();

	Error += test_inverse<glm::dmat4>();
	Error += test_inverse<glm::lowp_dmat4>();
	Error += test_inverse<glm::mediump_dmat4>();
	Error += test_inverse<glm::highp_dmat4>();

	Error += test_size();
	Error += test_constexpr();

	return Error;
}
예제 #6
0
int main(int argc, char** argv)
{
	printf("KEY META     TESTS\n");
	printf("==================\n\n");

	init (argc, argv);
	test_basic();
	test_iterate();
	test_size();
	test_uid();
	test_dup();
	test_comment();
	test_owner();
	test_mode();
	test_type();
	test_examples();
	test_copy();
	test_ro();
	test_new();
	test_copyall();


	printf("\ntest_ks RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError);

	return nbError;
}
예제 #7
0
파일: file_reader.c 프로젝트: vroussea/fdf
int			file_reader(char *file, int ***map)
{
	int		fd;
	int		ret;
	char	*line;
	int		i;

	if (!(init_map(map, file)))
		return (0);
	if (!test_file(file))
		return (0);
	i = 0;
	fd = open(file, O_RDONLY);
	while ((ret = get_next_line(fd, &line)) > 0)
	{
		if (!((*map)[i] = line_filler(line, (*map)[i])))
			return (0);
		ft_strdel(&line);
		i++;
	}
	if (!test_size(map))
		return (0);
	close(fd);
	return ((ret < 0) ? 0 : 1);
}
예제 #8
0
파일: texredefine.c 프로젝트: RAOF/piglit
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int sizeidx;

	testnr = 0;

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glClearColor(0.5, 0.5, 0.5, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	glEnable(GL_TEXTURE_2D);

	for(sizeidx = 0; sizeidx < sizeof(sizes)/sizeof(sizes[0]); ++sizeidx) {
		if (!test_size(sizes[sizeidx].w, sizes[sizeidx].h)) {
			pass = GL_FALSE;
		}
	}

	glDisable(GL_TEXTURE_2D);
	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
예제 #9
0
static int test_pbkdf2(const struct ccdigest_info *di) {
    static test_vector vector[] = {
        { password1, saltstr128, 100, 16,
            "4fb479b7843efec99b2a9d137682bba2", // MD2
            "a941b5a1246eb37e7d8bbfb803257d29", // MD4
            "c21f6f8b192757dc79bfd67378255152", // MD5
            "f61e774036c4007d4402fe9912e29a85", // SHA1
            "78e396298731187a7e9a355694296b1f", // SHA224
            "854a1e9b6834413dc51b4316dbe405e1", // SHA256
            "813022dc740ec35fb4c4eaf67cd42539", // SHA384
            "9842d62607fa2b5d5165d6526f74e119", // SHA512
            "5dd09887fd05b8140c51883f6bed9949", // RMD128
            "b68e9c0c55f521c3f2fcc84320a089de", // RMD160
            "1cdb7e76936a6c2f528a38521dab24a8", // RMD256
            "b68e9c0c55f521c3f2fcc84320a089de", // RMD320
        },
        { password1, saltstr128, 1000, 24,
            "ec806929819bb71b46b6552ac71d0e141af5360bfca0c03c", // MD2
            "b8d26c6338b43b11fe2c8c7a45d31b015f72ae7cfde36778", // MD4
            "cb2c261847e9e1c3141478bd084565da00024366ec9d167e", // MD5
            "0309e2fe4e0bdfe7d0fe4828d41c234416e2d9bfb61cdd8f", // SHA1
            "7d8603adef1af3704db8c7d2c471661ca73ac07c9044a5dc", // SHA224
            "25eb86acc76e43018f18b9a8f90c2fed462d1c799e83d48a", // SHA256
            "82d915ec6e30a50a987fe17cc6d260194c33fec4f2f14196", // SHA384
            "c74e4080d0fbb41fee5868c0ff60fd75acae2638215987e5", // SHA512
            "db8cc4a86241e5f9f4f2be8a020d2db8a6b065dc1604c92f", // RMD128
            "e4d14f220779d824d281b50a5c688a4071219411ce4ece1c", // RMD160
            "118c9330daafb701cd37c3f8e0f5fc1a1846b5e72153a65f", // RMD256
            "e4d14f220779d824d281b50a5c688a4071219411ce4ece1c", // RMD320
        },
        { password1, saltstr128, 10000, 8,
            "3e6698827388fc04", // MD2
            "a7e2590655919ffc", // MD4
            "d352d8ec8e276adc", // MD5
            "8e3e2f73c3eb6390", // SHA1
            "a7150cd1d2a90e2d", // SHA224
            "eb6c81535592203c", // SHA256
            "24f67028f09c4d89", // SHA384
            "5e5984ca905a5524", // SHA512
            "468f482fbf85e70b", // RMD128
            "b35814741b948ecb", // RMD160
            "9d544ae850aea450", // RMD256
            "b35814741b948ecb", // RMD320
        },

    };
    int vector_size = sizeof (vector) / sizeof (test_vector);
    if(verbose) diag("pbkdf2 LT Test\n");

    for(int i=0; i<vector_size; i++) {
        ok(test_oneshot(di, &vector[i]), "test one-shot with data less than blocksize");
    }
    test_size(di);
    return 1;
}
예제 #10
0
void hpack_size(grpc_end2end_test_config config) {
  static const int interesting_sizes[] = {4096, 0,     100,
                                          1000, 32768, 4 * 1024 * 1024};
  size_t i, j;

  for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) {
    for (j = 0; j < GPR_ARRAY_SIZE(interesting_sizes); j++) {
      test_size(config, interesting_sizes[i], interesting_sizes[j]);
    }
  }
}
예제 #11
0
int
main()
{
    std::list<int> const data = build_list();
    test_rbegin(data);
    test_rend(data);
    test_resize(data);
    test_size(data);
    test_splice(data);
    return boost::report_errors();
}
int main()
{
	int Error = 0;

	Error += cast::test();
	Error += test_ctr();
	Error += test_operators();
	Error += test_size();

	return Error;
}
예제 #13
0
int main()
{
	int Error = 0;

	Error += test_ctr();
	Error += test_two_axis_ctr();
	Error += test_size();
	Error += test_precision();
	Error += test_constexpr();

	return Error;
}
int
main()
{
    std::multimap<int, int> const data = build_multimap();
    test_multimap_insert(data);
    test_key_comp(data);
    test_max_size(data);
    test_rbegin(data);
    test_rend(data);
    test_size(data);
    test_value_comp(data);
    return boost::report_errors();
}
예제 #15
0
int main()
{
	int Error = 0;

	Error += test_dual_quat_ctr();
	Error += test_dquat_type();
	Error += test_scalars();
	Error += test_inverse();
	Error += test_mul();
	Error += test_size();

	return Error;
}
예제 #16
0
int
main()
{
    BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value));
    BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value));

    std::list<int> const data = build_list();
    test_rbegin(data);
    test_rend(data);
    test_resize(data);
    test_size(data);
    test_splice(data);
    return boost::report_errors();
}
예제 #17
0
void			find_len(t_list **lst, t_display *display)
{
	t_list			*tmp;

	tmp = *lst;
	while (tmp)
	{
		test_links(display, tmp);
		test_owner(display, tmp);
		test_group(display, tmp);
		test_size(display, tmp);
		tmp = tmp->next;
	}
}
int main(void)
{
	test_null();
	test_num();
	test_bytes();
	test_appendNum();
	test_appendBytes();
	test_toByte();
	test_toByte_4bitpadding();
	test_size();

	report();

	return 0;
}
예제 #19
0
파일: run-ffs.c 프로젝트: HSchroeder/ccan
int main(void)
{
	int i;

	/* Too complicated to work out the exact number */
	plan_no_plan();

	for (i = 0; i < NSIZES; i++) {
		diag("Testing %d-bit bitmap", bitmap_sizes[i]);
		test_size(bitmap_sizes[i]);
	}

	/* This exits depending on whether all tests passed */
	return exit_status();
}
예제 #20
0
		void test_static_array()
		{
			test_constructor_destructor();
			test_copy_constructor();
			test_move_constructor();
			test_size();
			test_deep_copy();
			test_reconstruct_element();
			test_reconstruct_array();
			test_zero_array();
			test_get();
			test_first_last();
			test_get_range();
			test_internal_array();
			test_range_copy();
		}
예제 #21
0
파일: sysdep.c 프로젝트: mmanley/Antares
static off_t
get_partition_size(int fd, off_t maxSize)
{
	// binary search
	off_t lower = 0;
	off_t upper = maxSize;
	while (lower < upper) {
		off_t mid = (lower + upper + 1) / 2;
		if (test_size(fd, mid))
			lower = mid;
		else
			upper = mid - 1;
	}

	return lower;
}
예제 #22
0
파일: correct.c 프로젝트: mheinsen/seec
int main(int argc, char *argv[])
{
  char *p = NULL;

  p = test_size(p, 0);
  p = test_size(p, 1);
  p = test_size(p, 8);
  p = test_size(p, 128);
  p = test_size(p, 1024);
  p = test_size(p, 16384);
  p = test_size(p, 8);

  exit(EXIT_SUCCESS);
}
예제 #23
0
int main(int argc, char **argv)
{
	test_null();
	test_num();
	test_bytes();
	test_appendNum();
	test_appendBytes();
	test_toByte();
	test_toByte_4bitpadding();
	test_size();
	test_append();

	report();

	return 0;
}
예제 #24
0
int
main()
{
    std::deque<int> const data = build_deque();
    test_insert(data);
    test_max_size(data);
    test_pop_back(data);
    test_pop_front(data);
    test_push_back(data);
    test_push_front(data);
    test_rbegin(data);
    test_rend(data);
    test_resize(data);
    test_size(data);
    return boost::report_errors();
}
예제 #25
0
int main(int argc, const char* argv[]) {
    (void)argc;
    (void)argv;
    if(argc<3) {
        return 1;
    }
    int maxu = atoi(argv[1]);
    int maxv = atoi(argv[2]);
    unsigned long long size = atoll(argv[3]);

    test_size(size, maxu, maxv);

    test_time(size, maxu, maxv);

    return 0;
}
예제 #26
0
int main()
{
	int Error = 0;

	repro Repro;

	Error += cast::test();
	Error += test_ctr();
	Error += test_inverse_dmat4x4();
	Error += test_inverse_mat4x4();
	Error += test_operators();
	Error += test_inverse();
	Error += test_size();

	Error += perf_mul();

	return Error;
}
예제 #27
0
int main()
{
    int Error = 0;

    Error += test_quat_ctr();
    Error += test_quat_mul_vec();
    Error += test_quat_two_axis_ctr();
    Error += test_quat_mul();
    Error += test_quat_precision();
    Error += test_quat_type();
    Error += test_quat_angle();
    Error += test_quat_angleAxis();
    Error += test_quat_mix();
    Error += test_quat_normalize();
    Error += test_quat_euler();
    Error += test_quat_slerp();
    Error += test_size();

    return Error;
}
예제 #28
0
int main(void)
{
	int totaltests = 0;
	int i;

	for (i = 0; i < NSIZES; i++) {
		int size = bitmap_sizes[i];

		/* Summing the arithmetic series gives: */
		totaltests += size*(size + 3) + 1;
	}
	plan_tests(totaltests);

	for (i = 0; i < NSIZES; i++) {
		diag("Testing %d-bit bitmap", bitmap_sizes[i]);
		test_size(bitmap_sizes[i]);
	}

	/* This exits depending on whether all tests passed */
	return exit_status();
}
예제 #29
0
파일: crc32-test.c 프로젝트: code-mx/amanda
int
main(int argc, char **argv)
{
    int i;
    int nb_error = 0;
    argc =argc;
    argv =argv;

    make_crc_table();
    init_test_buf();

    for (i=0; size_of_test[i] != 0; i++) {
	if (!test_size(size_of_test[i])) {
	    nb_error++;
	}
    }
    if (nb_error) {
	g_fprintf(stderr, " FAIL CRC \n");
    } else {
	g_fprintf(stderr, " PASS CRC\n");
    }
    return nb_error;
}
예제 #30
0
int
main(void) {
  test_construct_with_null();
  test_construct_with_empty_string();
  test_construct_with_nonempty_string();
  test_append_char();
  test_at();
  test_back();
  test_capacity();
  test_clear();
  test_compare();
  test_data();
  test_empty();
  test_free();
  test_front();
  test_length();
  test_max_size();
  test_pop_back();
  test_push_back();
  test_reserve();
  test_resize();
  test_size();
  return EXIT_SUCCESS;
}