Skip to content

Commit

Permalink
shared/format-table: print BPS with part after point
Browse files Browse the repository at this point in the history
Fixes systemd#33076.
"2Gbps" → "2.5Gbps".
  • Loading branch information
keszybz committed May 30, 2024
1 parent 11226bf commit 12080b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/shared/format-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
if (!p)
return NULL;

if (!format_bytes_full(p, FORMAT_BYTES_MAX, d->size, 0))
if (!format_bytes_full(p, FORMAT_BYTES_MAX, d->size, FORMAT_BYTES_BELOW_POINT))
return table_ersatz_string(t);

n = strlen(p);
Expand Down
16 changes: 8 additions & 8 deletions src/test/test-format-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,14 @@ TEST(table_bps) {

printf("%s", formatted);
assert_se(streq(formatted,
"UINT64 SIZE BPS\n"
"2500 2.4K 2Kbps\n"
"10000000 9.5M 10Mbps\n"
"20000000 19M 20Mbps\n"
"25000000 23.8M 25Mbps\n"
"1000000000 953.6M 1Gbps\n"
"2000000000 1.8G 2Gbps\n"
"2500000000 2.3G 2Gbps\n"
"UINT64 SIZE BPS\n"
"2500 2.4K 2.5Kbps\n"
"10000000 9.5M 10Mbps\n"
"20000000 19M 20Mbps\n"
"25000000 23.8M 25Mbps\n"
"1000000000 953.6M 1Gbps\n"
"2000000000 1.8G 2Gbps\n"
"2500000000 2.3G 2.5Gbps\n"
));
}

Expand Down

0 comments on commit 12080b1

Please sign in to comment.