Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added sprintf test cases for "%+.5f" "%.5f"
  • Loading branch information
dwarring committed Jul 30, 2014
1 parent 2a9f6c1 commit f0033ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S32-str/sprintf.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 149;
plan 155;

# L<S32::Str/Str/"identical to" "C library sprintf">

Expand Down Expand Up @@ -186,6 +186,14 @@ ok sprintf('%020.2G', -3.1415e30) eq '-000000000003.1E+030' | '-0000000000003.1
ok sprintf('%020.2g', -3.1415e-30) eq '-000000000003.1e-030' | '-0000000000003.1e-30', 'negative 020.2 %g';
ok sprintf('%020.2G', -3.1415e-30) eq '-000000000003.1E-030' | '-0000000000003.1E-30', 'negative 020.2 %G';

is sprintf("%.5f", pi), '3.14159', '"%.5"';
is sprintf("%.5f", -pi), '-3.14159', 'negative "%.5"';
is sprintf("%+.5f", -pi), '-3.14159', 'negative "%+.5"';
#?rakudo 3 todo 'RT #122437'
is sprintf("%+.5f", pi), '+3.14159', '"%+.5"';
is sprintf("% .5f", pi), '+3.14159', '" %.5"';
is sprintf("% .5f", -pi), ' 3.14159', 'negative "%.5"';

is sprintf('%e', 2.718281828459), sprintf('%.6e', 2.718281828459), '%e defaults to .6';
is sprintf('%E', 2.718281828459), sprintf('%.6E', 2.718281828459), '%E defaults to .6';
is sprintf('%f', 2.718281828459), sprintf('%.6f', 2.718281828459), '%f defaults to .6';
Expand Down

0 comments on commit f0033ca

Please sign in to comment.