Skip to content

Commit

Permalink
[bugfix] Addressed PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanofthelost committed Jan 16, 2023
1 parent 9eb6c5f commit 3f79c96
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
12 changes: 6 additions & 6 deletions srecord/arglex/tool/get_number.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ srecord::arglex_tool::get_number(const char *caption)
case token_round_down:
token_next();
multiple = get_number("-round-down");
if(multiple == 0)
if (multiple == 0)
{
fatal_error ("-Round_Down value must not be 0");
fatal_error("-Round_Down value must not be 0");
}
value /= multiple;
value *= multiple;
Expand All @@ -109,9 +109,9 @@ srecord::arglex_tool::get_number(const char *caption)
case token_round_up:
token_next();
multiple = get_number("-round-up");
if(multiple == 0)
if (multiple == 0)
{
fatal_error ("-Round_Up value must not be 0");
fatal_error("-Round_Up value must not be 0");
}
value = (value + multiple - 1) / multiple;
value *= multiple;
Expand All @@ -120,9 +120,9 @@ srecord::arglex_tool::get_number(const char *caption)
case token_round_nearest:
token_next();
multiple = get_number("-round-nearest");
if(multiple == 0)
if (multiple == 0)
{
fatal_error ("-Round_Nearest value must not be 0");
fatal_error("-Round_Nearest value must not be 0");
}
value = (value + multiple / 2) / multiple;
value *= multiple;
Expand Down
18 changes: 9 additions & 9 deletions test/02/t0262a.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# srecord - Manipulate EPROM load files
# Copyright (C) 2014 Markus Heidelberg
# Copyright (C) 2023 Sean Alling
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,15 +20,15 @@
TEST_SUBJECT="-Round_Up"
. test_prelude.sh

srec_cat -generate 0 8 -constant 0 -offset - 1 -Round_Up 0 \
2> test.out

if test $? -ne 1; then fail; fi

cat > test.ok << 'fubar'
S00600004844521B
S306FFFFFFFE00FE
S5030001FB
srec_cat: -Round_Up value must not be 0
fubar
if test $? -ne 0; then no_result; fi

srec_cat test.in -offset - 1 -Round_Up 0 -o test.out

if test $? -ne 1; then fail; fi

pass
diff -u test.ok test.out
if test $? -ne 0; then fail; fi
18 changes: 9 additions & 9 deletions test/02/t0263a.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# srecord - Manipulate EPROM load files
# Copyright (C) 2014 Markus Heidelberg
# Copyright (C) 2023 Sean Alling
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,16 +20,16 @@
TEST_SUBJECT="-Round_Down"
. test_prelude.sh

srec_cat -generate 0 8 -constant 0 -offset - 1 -Round_Up 0 \
2> test.out

if test $? -ne 1; then fail; fi

cat > test.ok << 'fubar'
S00600004844521B
S306FFFFFFFE00FE
S5030001FB
srec_cat: -Round_Up value must not be 0
fubar
if test $? -ne 0; then no_result; fi

srec_cat test.in -offset - 1 -Round_Down 0 -o test.out

if test $? -ne 1; then fail; fi

diff -u test.ok test.out
if test $? -ne 0; then fail; fi

pass
19 changes: 9 additions & 10 deletions test/02/t0264a.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# srecord - Manipulate EPROM load files
# Copyright (C) 2014 Markus Heidelberg
# Copyright (C) 2023 Sean Alling
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,16 +20,15 @@
TEST_SUBJECT="-Round_Nearest"
. test_prelude.sh

cat > test.ok << 'fubar'
S00600004844521B
S306FFFFFFFE00FE
S5030001FB
fubar
if test $? -ne 0; then no_result; fi

srec_cat test.in -offset - 1 -Round_Nearest 0 -o test.out
srec_cat -generate 0 8 -constant 0 -offset - 1 -Round_Nearest 0 \
2> test.out

if test $? -ne 1; then fail; fi

cat > test.ok << 'fubar'
srec_cat: -Round_Nearest value must not be 0
fubar
if test $? -ne 0; then no_result; fi

pass
diff -u test.ok test.out
if test $? -ne 0; then fail; fi

0 comments on commit 3f79c96

Please sign in to comment.