Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add sprintf benchmark.
Tests position and non-positional arguments with two test string.
- Loading branch information
Carlos O'Donell
committed
May 21, 2015
1 parent
2212c14
commit 608f897
Showing
4 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## args: char *:const char *:int:char:char:char:char:char:const char *:float:unsigned int | ||
## ret: int | ||
## includes: stdio.h | ||
## include-sources: sprintf-source.c | ||
## name: positional | ||
# Test positional arguments: | ||
buf, FORMAT1, 1001, '1', '2', '3', '4', '5', "string", 1.5, 0x1234 | ||
## name: non-positional | ||
# Test non-positional arguments: | ||
buf, FORMAT2, 1001, '1', '2', '3', '4', '5', "string", 1.5, 0x1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* A set of arbitrarily selected positional format specifiers. */ | ||
#define FORMAT1 " %1$d: %2$c%3$c%4$c%5$c%6$c %7$20s %8$f (%9$02x)\n" | ||
/* A matching, but arbitrarily selected, set of non-positional format specifiers. */ | ||
#define FORMAT2 " %d: %c%c%c%c%c %20s %f (%02x)\n" | ||
/* Sufficiently large buffer. */ | ||
char buf[256]; |