Exemple #1
0
int main()
{
	plan(20);
	test_uints();
	test_ints();
	test_bools();
	test_floats();
	test_doubles();
	test_nils();
	test_strls();
	test_binls();
	test_strs();
	test_bins();
	test_arrays();
	test_maps();
	test_next_on_arrays();
	test_next_on_maps();
	test_compare_uints();
	test_format();
	test_mp_print();
	test_mp_check();
	test_numbers();
	test_overflow();

	return check_plan();
}
Exemple #2
0
int
main(void)
{
    test_equal();

    test_overflow();

    lzma_index *i = create_empty();
    test_many(i);
    lzma_index_end(i, NULL);

    i = create_small();
    test_many(i);
    lzma_index_end(i, NULL);

    i = create_big();
    test_many(i);
    lzma_index_end(i, NULL);

    test_cat();

    test_locate();

    test_corrupt();

    return 0;
}
Exemple #3
0
int main() {

    test_zero("strtonumtest: 0 test");
    test_one("strtonumtest: -1 test");
    test_badnum("strtonumtest: bad number test");
    test_overflow("strtonumtest: overflow test");
    test_minmax("strtonumtest: minmax test");

    _exit(0);
}
Exemple #4
0
int main(int argc, char *argv[]) {
    grpc_test_init(argc, argv);

    test_values();
    test_add_sub();
    test_overflow();
    test_sticky_infinities();
    test_similar();
    return 0;
}
int
main(void)
{
	test_equal();

	test_overflow();

	lzma_index *i = create_empty();
	test_many(i);
	lzma_index_end(i, NULL);

	i = create_small();
	test_many(i);
	lzma_index_end(i, NULL);

	i = create_big();
	test_many(i);
	lzma_index_end(i, NULL);

	test_cat();

	test_locate();

	test_corrupt();

	// Test for the bug fix 21515d79d778b8730a434f151b07202d52a04611:
	// liblzma: Fix lzma_index_dup() for empty Streams.
	i = create_empty();
	expect(lzma_index_stream_padding(i, 4) == LZMA_OK);
	test_copy(i);
	lzma_index_end(i, NULL);

	// Test for the bug fix 3bf857edfef51374f6f3fffae3d817f57d3264a0:
	// liblzma: Fix a memory leak in error path of lzma_index_dup().
	// Use Valgrind to see that there are no leaks.
	i = create_small();
	expect(lzma_index_dup(i, &my_allocator) == NULL);
	lzma_index_end(i, NULL);

	return 0;
}
Exemple #6
0
int
main(int argc, char *argv[])
{

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

	/* Test csqrt() */
	t_csqrt = _csqrt;

	test_finite();
	printf("ok 1 - csqrt\n");

	test_zeros();
	printf("ok 2 - csqrt\n");

	test_infinities();
	printf("ok 3 - csqrt\n");

	test_nans();
	printf("ok 4 - csqrt\n");

	test_overflow(DBL_MAX_EXP);
	printf("ok 5 - csqrt\n");

	/* Now test csqrtf() */
	t_csqrt = _csqrtf;

	test_finite();
	printf("ok 6 - csqrt\n");

	test_zeros();
	printf("ok 7 - csqrt\n");

	test_infinities();
	printf("ok 8 - csqrt\n");

	test_nans();
	printf("ok 9 - csqrt\n");

	test_overflow(FLT_MAX_EXP);
	printf("ok 10 - csqrt\n");

	/* Now test csqrtl() */
	t_csqrt = csqrtl;

	test_finite();
	printf("ok 11 - csqrt\n");

	test_zeros();
	printf("ok 12 - csqrt\n");

	test_infinities();
	printf("ok 13 - csqrt\n");

	test_nans();
	printf("ok 14 - csqrt\n");

	test_overflow(LDBL_MAX_EXP);
	printf("ok 15 - csqrt\n");

	return (0);
}
Exemple #7
0
	void BRR_CompressBlock( int* source, int* dest, cresult* presult, int ffixed )
	{
		// source   = source buffer
		// dest     = return buffer (compressed data)
		// presults = result return
		// ffixed   = filter selection
		int		r_shift;
		int		r_half;
		int		c;
		int		s1;
		int		s2;
		int		rs1;
		int		rs2;
		int		ra;
		int		rb;
		int		cp;
		int		c_1;
		int		c_2;
		int		x;
		int		block_data[16];
		int		block_error;
		int		block_errorb=2147483647; // max
		int		block_datab[16];
		int		block_samp[16];
		int		block_sampb[18];
		int		block_rangeb;
		int		block_filterb;
		int		filter;
		int		fmin;
		int		fmax;
		// set filter ranges
		if( ffixed == 4 )
		{
			fmin = 0;
			fmax = 3;
		}
		else
		{
			fmin = ffixed;
			fmax = ffixed;
		}
		// loop through filters
		for( filter = fmin; filter <= fmax; filter++ )
		{
			// loop through ranges
			for( r_shift = 12; r_shift >= 0; r_shift-- )
			{
				r_half		=(1 << r_shift) >> 1;	// half shift value (for rounding)
				c_1			=source[-1];			// previous samp 1
				c_2			=source[-2];			// previous samp 2
				block_error =0;						// reset error
				// loop through samples
				for( x = 0; x < 16; x++ )
				{
					// calculate filter values
					cp = ComputeFilter( c_2, c_1, filter );
					c = source[x] >> 1;						// load sample, /2
					s1 = (signed short int)(c & 0x7FFF);	// uhh? :)
					s2 = (signed short int)(c | 0x8000);	// 
					s1 -= cp;								// undo filter
					s2 -= cp;								//
					
					s1 <<= 1;								// restore lost bit
					s2 <<= 1;								//
					
					s1 += r_half;							// shift and round
					s2 += r_half;							//
					s1 >>= r_shift;							//
					s2 >>= r_shift;							//

					s1 = ClampNibble( s1 );					// clamp
					s2 = ClampNibble( s2 );					//
					rs1 = s1;								// save data
					rs2 = s2;								//
					
					s1 = (s1 << r_shift) >> 1;				// undo shift
					s2 = (s2 << r_shift) >> 1;				//
					
					if( filter >= 2 )						// apply filter
					{										//
						s1 = ClampWord( s1 + cp );			//
						s2 = ClampWord( s2 + cp );			//
					}										//
					else									//
					{										//
						s1 = s1 + cp;						//
						s2 = s2 + cp;						//
					}										//
					
					s1 = ((signed short int)( s1 << 1 )) >> 1;	// sign extend
					s2 = ((signed short int)( s2 << 1 )) >> 1;	//
					
					ra = (c) - s1;							// check difference
					rb = (c) - s2;							//
					
					if( ra < 0 ) ra = -ra;					// absolute value
					if( rb < 0 ) rb = -rb;					//
					
					if( ra < rb )							// pick lesser error value
					{										//
						block_error += (int)ra;				// add error value
						block_data[x] = rs1;				// set data
					}										//
					else									//
					{										//
						block_error += (int)rb;				// add error value
						block_data[x] = rs2;				// set data
						s1 = s2;							//
					}										//

					if( block_data[x] < 0 )					// unsign nibble
						block_data[x] += 16;
					c_2 = c_1;								// set previous samples
					c_1 = s1;								//
					
					block_samp[x] = s1;						// save sample
				}
				// check if error rate is lower than current
				if( block_error < block_errorb )
				{
					// copy all data to "best" buffer
					block_errorb = block_error;
					block_rangeb = r_shift;
					block_filterb = filter;
					for( x = 0; x < 16; x++ )
						block_datab[x] = block_data[x];
					for( x = 0; x < 16; x++ )
						block_sampb[x+2] = block_samp[x];
				}
			}
		}
		
		unsigned int overflow=0;
		
		block_sampb[0] = block_sampb[14+2];
		block_sampb[1] = block_sampb[15+2];
		for( x = 0; x < 16; x++ )
		{
			overflow = (overflow << 1) | test_overflow( block_sampb + x );
		}
		
		// copy best buffer to output
		for( x = 0; x < 16; x++ )
			dest[x] = block_datab[x];
		
		// copy affected sample data
		for( x = 0; x < 16; x++ )
			presult->samp[x] = block_sampb[x+2];
		
		// return results
		presult->range = block_rangeb;
		presult->filter = block_filterb;
		presult->samp_loss = block_errorb;
		
		if( overflow )
			presult->overflow = true;
		else
			presult->overflow = false;
	}