当前位置: 首页>>代码示例>>C++>>正文


C++ print_test_name函数代码示例

本文整理汇总了C++中print_test_name函数的典型用法代码示例。如果您正苦于以下问题:C++ print_test_name函数的具体用法?C++ print_test_name怎么用?C++ print_test_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_test_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: header_shrink_test

static void
header_shrink_test (const char *filename, int filetype)
{	SNDFILE *outfile, *infile ;
	SF_INFO sfinfo ;
	sf_count_t frames ;
	float buffer [8], bufferin [8] ;

	print_test_name ("header_shrink_test", filename) ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;
	sfinfo.samplerate = 44100 ;
	sfinfo.format = filetype | SF_FORMAT_FLOAT ;
	sfinfo.channels = 1 ;

	memset (buffer, 0xA0, sizeof (buffer)) ;

	/* Now write some frames. */
	frames = ARRAY_LEN (buffer) / sfinfo.channels ;

	/* Test the file with extra header data. */
	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;

	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
	sf_command (outfile, SFC_UPDATE_HEADER_NOW, NULL, SF_FALSE) ;
	sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;

	test_writef_float_or_die (outfile, 0, buffer, frames, __LINE__) ;
	sf_close (outfile) ;

	/* Open again for read. */
	infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;

	test_readf_float_or_die (infile, 0, bufferin, frames, __LINE__) ;
	sf_close (infile) ;

	compare_float_or_die (buffer, bufferin, frames, __LINE__) ;

	unlink (filename) ;
	puts ("ok") ;
	return ;
} /* header_shrink_test */
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:41,代码来源:header_test.c

示例2: test_puts

void	test_puts(void)
{
	int		orignal;
	int		homemade;

	print_test_name("------------PUTS------------");
	printf("\n\n");
	test_simple();
	printf("s: ");
	printf(STRING);
	printf("\n");
	printf("Original: ");
	orignal = puts(STRING);
	fflush(stdout);
	printf("Returned: ");
	ft_putnbr(orignal);
	printf("\n");
	printf("Homemade: ");
	fflush(stdout);
	homemade = ft_puts(STRING);
	printf("Returned: ");
	ft_putnbr(homemade);
	ok();
	printf("s: ");
	printf("NULL");
	printf("\n");
	printf("Original: ");
	orignal = puts(STRINGNULL);
	fflush(stdout);
	printf("Returned: ");
	ft_putnbr(orignal);
	printf("\n");
	printf("Homemade: ");
	fflush(stdout);
	homemade = ft_puts(STRINGNULL);
	printf("Returned: ");
	ft_putnbr(homemade);
	ok();
	printf("\n");
}
开发者ID:Nenalant,项目名称:Libftasm,代码行数:40,代码来源:main.c

示例3: test_strcat

static void	test_strcat(void)
{
	int		test[1], ctrl[1];
	char	*dst1, *dst2, src[]="test";
	char	tab1[100];
	char	tab2[100];
	char	*p1;
	char	*p2;
	
	print_test_name("------------STRCAT------------");
	printf("\n\n");
	test_simple();
	printf("s1: ");
	printf("%s\n", STR);
	printf("s2: ");
	printf("%s\n", STR2);
	printf("Original: ");
	strcpy(tab1, STR);
	p1 = strcpy(tab1, STR2);
	printf("%s\n", p1);
	printf("Homemade: ");
	strcpy(tab1, STR);
	p2 = ft_strcpy(tab2, STR2);
	printf("%s", p2);
	ok();
	if (!(dst1 = malloc(sizeof(*dst1) * (strlen(src) + 1) * 3)) || !(dst2 = malloc(sizeof(*dst2) * (strlen(src) + 1) * 3)))
	{
		perror("malloc() failed");
		exit(EXIT_FAILURE);
	}
	strcpy(dst1, src);
	strcpy(dst2, src);
	ctrl[0] = 0;
	test[0] = cmp(strcat(dst1, src), ft_strcat(dst2, src));
	free(dst1);
	free(dst2);
	test_hard();
	print_test_results(test, ctrl, 1, NULL);
	printf("\n");
}
开发者ID:Nenalant,项目名称:Libftasm,代码行数:40,代码来源:main.c

示例4: main

int
main (void)
{	SNDFILE		*sndfile ;
	SF_INFO		sfinfo ;

	FILE		*bad_file ;
	const char	*bad_wav = "bad_wav.wav" ;
	const char	bad_data [] = "RIFF    WAVEfmt            " ;

	print_test_name ("open_fail_test", bad_wav) ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;

	sndfile = sf_open ("let's hope this file doesn't exist", SFM_READ, &sfinfo) ;

	if (sndfile)
	{	printf ("Line %d: should not have received a valid SNDFILE* pointer.\n", __LINE__) ;
		exit (1) ;
		} ;

	if ((bad_file = fopen (bad_wav, "w")) == NULL)
	{	printf ("Line %d: fopen returned NULL.\n", __LINE__) ;
		exit (1) ;
		} ;

	fwrite (bad_data, sizeof (bad_data), 1, bad_file) ;
	fclose (bad_file) ;

	sndfile = sf_open (bad_wav, SFM_READ, &sfinfo) ;

	if (sndfile)
	{	printf ("Line %d: should not have received a valid SNDFILE* pointer.\n", __LINE__) ;
		exit (1) ;
		} ;

	unlink (bad_wav) ;
	puts ("ok") ;

	return 0 ;
} /* main */
开发者ID:AaronFae,项目名称:VimProject,代码行数:40,代码来源:open_fail_test.c

示例5: stdio_test

static void
stdio_test (const char *filetype)
{	static char buffer [256] ;

	int file_size, retval ;

	print_test_name ("stdio_test", filetype) ;

	snprintf (buffer, sizeof (buffer), "./stdout_test %s > stdio.%s", filetype, filetype) ;
	if ((retval = system (buffer)))
	{	retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
		printf ("%s : %s", buffer, (strerror (retval))) ;
		exit (1) ;
		} ;

	snprintf (buffer, sizeof (buffer), "stdio.%s", filetype) ;
	if ((file_size = file_length (buffer)) < PIPE_TEST_LEN)
	{	printf ("\n    Error : test file '%s' too small (%d).\n\n", buffer, file_size) ;
		exit (1) ;
		} ;

	snprintf (buffer, sizeof (buffer), "./stdin_test %s < stdio.%s", filetype, filetype) ;
	if ((retval = system (buffer)))
	{	retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
		printf ("%s : %s", buffer, (strerror (retval))) ;
		exit (1) ;
		} ;

	snprintf (buffer, sizeof (buffer), "rm stdio.%s", filetype) ;
	if ((retval = system (buffer)))
	{	retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
		printf ("%s : %s", buffer, (strerror (retval))) ;
		exit (1) ;
		} ;

	puts ("ok") ;

	return ;
} /* stdio_test */
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:39,代码来源:stdio_test.c

示例6: test_strcpy

static void	test_strcpy(void)
{
	int		test[2], ctrl[2];
	char	*dst1, *dst2, src1[]="\001test string\200", src2[]="test";
	char	tab1[100];
	char	tab2[100];
	char	*p1;
	char	*p2;
	
	print_test_name("------------STRCPY------------");
	printf("\n\n");
	test_simple();
	printf("s: ");
	printf("%s\n", STRING);
	printf("Original: ");
	p1 = strcpy(tab1, STRING);
	printf("%s\n", p1);
	printf("Homemade: ");
	p2 = ft_strcpy(tab2, STRING);
	printf("%s", p2);
	ok();
	init(ctrl, 2, 0);
	init(test, 2, 1);
	if (!(dst1 = malloc(strlen(src1) + 1)) || !(dst2 = malloc(strlen(src1) + 1)))
	{
		perror("malloc() failed");
		exit(EXIT_FAILURE);
	}
	test[0] = cmp(strcpy(dst1, src1), ft_strcpy(dst2, src1));
	ft_strcpy(dst1, src2);
	if (!dst1[strlen(src2)])
		test[1] = 0;
	free(dst1);
	free(dst2);
	test_hard();
	print_test_results(test, ctrl, 2, NULL);
	printf("\n");
}
开发者ID:Nenalant,项目名称:Libftasm,代码行数:38,代码来源:main.c

示例7: update_header_test

static void
update_header_test (const char *filename, int typemajor)
{
	print_test_name ("update_header_test", filename) ;

#if 0 /*-(OS_IS_WIN32 == 0)-*/
	if (typemajor == SF_FORMAT_PAF)
	{	/*
		** I think this is a bug in the win32 file I/O code in src/file_io.c.
		** I didn't write that code and I don't have the time to debug and
		** fix it. Patches will gladly be accepted. Erik
		*/
		puts ("doesn't work on win32") ;
		return ;
		} ;
#endif

	update_header_sub (filename, typemajor, SFM_WRITE) ;
	update_header_sub (filename, typemajor, SFM_RDWR) ;

	unlink (filename) ;
	puts ("ok") ;
} /* update_header_test */
开发者ID:AaronFae,项目名称:VimProject,代码行数:23,代码来源:header_test.c

示例8: zero_data_test

static void
zero_data_test (const char *filename, int format)
{	SNDFILE		*file ;
	SF_INFO		sfinfo ;
	int			frames ;

	switch (format & SF_FORMAT_TYPEMASK)
	{	case SF_FORMAT_OGG :
			if (HAVE_EXTERNAL_LIBS == 0)
				return ;
			break ;
		default :
			break ;
		} ;

	print_test_name ("zero_data_test", filename) ;

	sfinfo.samplerate = 44100 ;
	sfinfo.format = format ;
	sfinfo.channels = 1 ;
	sfinfo.frames = 0 ;

	frames = BUFFER_LEN / sfinfo.channels ;

	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;

	sf_close (file) ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;

	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;

	sf_close (file) ;

	unlink (filename) ;
	puts ("ok") ;
} /* zero_data_test */
开发者ID:AkiraShirase,项目名称:audacity,代码行数:37,代码来源:misc_test.c

示例9: broadcast_rdwr_test

static	void
broadcast_rdwr_test (const char *filename, int filetype)
{	SF_BROADCAST_INFO binfo ;
	SNDFILE *file ;
	SF_INFO sfinfo ;
	sf_count_t frames ;

	print_test_name (__func__, filename) ;

	create_short_sndfile (filename, filetype, 2) ;

	memset (&sfinfo, 0, sizeof (sfinfo)) ;
	memset (&binfo, 0, sizeof (binfo)) ;

	snprintf (binfo.description, sizeof (binfo.description), "Test description") ;
	snprintf (binfo.originator, sizeof (binfo.originator), "Test originator") ;
	snprintf (binfo.originator_reference, sizeof (binfo.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
	snprintf (binfo.origination_date, sizeof (binfo.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
	snprintf (binfo.origination_time, sizeof (binfo.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
	snprintf (binfo.umid, sizeof (binfo.umid), "Some umid") ;
	binfo.coding_history_size = 0 ;

	file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
	frames = sfinfo.frames ;
	if (sf_command (file, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) != SF_FALSE)
	{	printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) should have failed but didn't.\n\n", __LINE__) ;
		exit (1) ;
		} ;
	sf_close (file) ;

	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
	sf_close (file) ;
	exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;

	unlink (filename) ;
	puts ("ok") ;
} /* broadcast_rdwr_test */
开发者ID:5in4,项目名称:libsox.dll,代码行数:37,代码来源:command_test.c

示例10: bad_raw_test

static void
bad_raw_test (void)
{	FILE		*textfile ;
	SNDFILE		*file ;
	SF_INFO		sfinfo ;
	const char	*errorstr, *filename = "bad.raw" ;

	print_test_name ("bad_raw_test", filename) ;

	if ((textfile = fopen (filename, "w")) == NULL)
	{	printf ("\n\nLine %d : not able to open text file for write.\n", __LINE__) ;
		exit (1) ;
		} ;

	fprintf (textfile, "This is not a valid file.\n") ;
	fclose (textfile) ;

	sfinfo.samplerate	= 44100 ;
	sfinfo.format		= SF_FORMAT_RAW | 0xABCD ;
	sfinfo.channels		= 1 ;

	if ((file = sf_open (filename, SFM_READ, &sfinfo)) != NULL)
	{	printf ("\n\nLine %d : Error, file should not have opened.\n", __LINE__ - 1) ;
		exit (1) ;
		} ;

	errorstr = sf_strerror (file) ;

	if (strstr (errorstr, "Bad format field in SF_INFO struct") == NULL)
	{	printf ("\n\nLine %d : Error bad error string : %s.\n", __LINE__ - 1, errorstr) ;
		exit (1) ;
		} ;

	unlink (filename) ;

	puts ("ok") ;
} /* bad_raw_test */
开发者ID:erikd,项目名称:libsndfile,代码行数:37,代码来源:raw_test.c

示例11: useek_pipe_rw_test

static void
useek_pipe_rw_test (int filetype, const char *ext)
{	SF_INFO sfinfo_write ;
	SF_INFO sfinfo_read ;

	print_test_name ("useek_pipe_rw_test", ext) ;

	/*
	** Setup the INFO structures for the filetype we will be
	** working with.
	*/
	sfinfo_write.format = filetype | SF_FORMAT_PCM_16 ;
	sfinfo_write.channels = 1 ;
	sfinfo_write.samplerate = 44100 ;


	sfinfo_read.format = 0 ;
	if (filetype == SF_FORMAT_RAW)
	{	sfinfo_read.format = filetype | SF_FORMAT_PCM_16 ;
		sfinfo_read.channels = 1 ;
		sfinfo_read.samplerate = 44100 ;
		} ;

	useek_pipe_rw_short (ext, &sfinfo_write, &sfinfo_read) ;

	sfinfo_read.format = sfinfo_write.format = filetype | SF_FORMAT_FLOAT ;
	if (sf_format_check (&sfinfo_read) != 0)
		useek_pipe_rw_float (ext, &sfinfo_write, &sfinfo_read) ;

	sfinfo_read.format = sfinfo_write.format = filetype | SF_FORMAT_DOUBLE ;
	if (sf_format_check (&sfinfo_read) != 0)
		useek_pipe_rw_double (ext, &sfinfo_write, &sfinfo_read) ;

	puts ("ok") ;
	return ;
} /* useek_pipe_rw_test */
开发者ID:ruthmagnus,项目名称:audacity,代码行数:36,代码来源:pipe_test.c

示例12: subtype_format_test

static void
subtype_format_test (void)
{	SF_FORMAT_INFO	info ;
	int have_vorbis = 0 ;
	int s, subtype_count ;

	print_test_name (__func__, NULL) ;

	sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;

	for (s = 0 ; s < subtype_count ; s++)
	{	info.format = s ;
		sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ;

		have_vorbis = info.format == SF_FORMAT_VORBIS ? 1 : have_vorbis ;
		} ;

	if (HAVE_EXTERNAL_LIBS)
		exit_if_true (have_vorbis == 0, "\n\nLine %d : Ogg/Vorbis should be available.\n\n", __LINE__) ;
	else
		exit_if_true (have_vorbis, "\n\nLine %d : Ogg/Vorbis should not be available.\n\n", __LINE__) ;

	puts ("ok") ;
} /* subtype_format_test */
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:24,代码来源:external_libs_test.c

示例13: largefile_test

static void
largefile_test (int filetype, const char * filename)
{	static float data [BUFFER_LEN] ;
	SNDFILE		*file ;
	SF_INFO		sfinfo ;
	int k ;

	print_test_name ("largefile_test", filename) ;

	sfinfo.samplerate	= 44100 ;
	sfinfo.channels		= 2 ;
	sfinfo.frames		= 0 ;
	sfinfo.format = (filetype | SF_FORMAT_PCM_32) ;

	file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;

	for (k = 0 ; k < BUFFER_COUNT ; k++)
		test_write_float_or_die (file, k, data, BUFFER_LEN, __LINE__) ;

	sf_close (file) ;

	file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;

	if ((sfinfo.frames * sfinfo.channels) / BUFFER_LEN != BUFFER_COUNT)
	{	printf ("\n\nLine %d : bad frame count.\n", __LINE__) ;
		exit (1) ;
		} ;

	sf_close (file) ;

	unlink (filename) ;
	puts ("ok") ;


	return ;
} /* largefile_test */
开发者ID:AaronFae,项目名称:VimProject,代码行数:36,代码来源:largefile_test.c

示例14: test_double_convert

void
test_double_convert (void)
{	static double data [] =
	{	0.0, 1.0, -1.0, 1.0 * M_PI, -1.0 * M_PI,
		1e9, -1e9, 1e-9, -1e-9, 1e-10, -1e-10,
		1e-19, -1e-19, 1e19, -1e19, 1e-20, -1e-20,
		} ;

	int k ;

	print_test_name (__func__) ;

	for (k = 0 ; k < ARRAY_LEN (data) ; k++)
	{	unsigned char bytes [8] ;
		double test ;

		double64_le_write (data [k], bytes) ;
		test = double64_le_read (bytes) ;

		if (fabs (data [k] - test) > 1e-20)
		{	printf ("\n\nLine %d : Test %d, little endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test) ;
			exit (1) ;
			} ;

		double64_be_write (data [k], bytes) ;
		test = double64_be_read (bytes) ;

		if (fabs (data [k] - test) > 1e-20)
		{	printf ("\n\nLine %d : Test %d, big endian error %.15g -> %.15g.\n\n", __LINE__, k, data [k], test) ;
			exit (1) ;
			} ;

		} ;

	puts ("ok") ;
} /* test_double_convert */
开发者ID:CarlosXViera,项目名称:SoundShake,代码行数:36,代码来源:test_float.c

示例15: pipe_read_test

static void
pipe_read_test (int filetype, const char *ext)
{	static short data [PIPE_TEST_LEN] ;
	static char buffer [256] ;
	static char filename [256] ;

	SNDFILE	*outfile ;
	SF_INFO sfinfo ;
	int k, retval ;

	snprintf (filename, sizeof (filename), "pipe_in.%s", ext) ;
	print_test_name ("pipe_read_test", filename) ;

	sfinfo.format = filetype | SF_FORMAT_PCM_16 ;
	sfinfo.channels = 1 ;
	sfinfo.samplerate = 44100 ;

	for (k = 0 ; k < PIPE_TEST_LEN ; k++)
		data [k] = PIPE_INDEX (k) ;

	outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, __LINE__) ;
	test_writef_short_or_die (outfile, 0, data, PIPE_TEST_LEN, __LINE__) ;
	sf_close (outfile) ;

	snprintf (buffer, sizeof (buffer), "cat %s | ./stdin_test %s ", filename, ext) ;
	if ((retval = system (buffer)) != 0)
	{	retval = WEXITSTATUS (retval) ;
		printf ("\n\n    Line %d : pipe test returned error for file type \"%s\".\n\n", __LINE__, ext) ;
		exit (retval) ;
		} ;

	unlink (filename) ;
	puts ("ok") ;

	return ;
} /* pipe_read_test */
开发者ID:ruthmagnus,项目名称:audacity,代码行数:36,代码来源:pipe_test.c


注:本文中的print_test_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。