Skip to content

Commit

Permalink
#75 frame removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 18, 2024
1 parent 96805f8 commit 3b8fae1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
7 changes: 0 additions & 7 deletions lib/fbe/award.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ def calc(bill)
[to_val(@operands[0], bill), to_val(@operands[1], bill)].max
when :min
[to_val(@operands[0], bill), to_val(@operands[1], bill)].min
when :frame
v = to_val(@operands[0], bill)
min = to_val(@operands[1], bill)
max = to_val(@operands[2], bill)
v.clamp(min, max)
when :between
v = to_val(@operands[0], bill)
a = to_val(@operands[1], bill)
Expand Down Expand Up @@ -220,8 +215,6 @@ def to_s
"minimum of #{to_p(@operands[0])} and #{to_p(@operands[1])}"
when :between
"at least #{to_p(@operands[0])} and at most #{to_p(@operands[1])}"
when :frame
to_p(@operands[0])
else
raise "Unknown term '#{@op}'"
end
Expand Down
9 changes: 2 additions & 7 deletions test/fbe/test_award.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_simple
(in hours "hours passed between bug reported and closed")
(let max 36)
(let basis 30)
(give (frame basis 10 50) "as a basis")
(give basis "as a basis")
(let fee 10)
(aka
(set b1
Expand Down Expand Up @@ -84,9 +84,6 @@ def test_some_terms
{
'(let x 25)' => 0,
'(award (give (times 5 0.25 "fun")))' => 1,
'(award (give (frame 5 1 15)))' => 5,
'(award (give (frame 5 10 15)))' => 10,
'(award (give (frame 5 1 3)))' => 3,
'(award (give 25 "for being a good boy"))' => 25,
'(award (give (between 42 -10 -50) "empty"))' => -10,
'(award (give (between -3 -10 -50) "empty"))' => 0,
Expand Down Expand Up @@ -130,9 +127,7 @@ def test_some_policies
'(award (let x_a 25) (set z (plus x_a 1)) (give z "..."))' =>
'First, let _x-a_ be equal to **25**. Then, set _z_ to _x-a_ + **1**, and award _z_.',
'(award (aka (let x 17) (give x "hey") "add ${x} when necessary"))' =>
'Just add **17** when necessary',
'(award (let x 10) (give (frame x 4 16) "for fun"))' =>
'First, let _x_ be equal to **10**, and award _x_.'
'Just add **17** when necessary'
}.each do |q, t|
md = Fbe::Award.new(q).policy.markdown
assert(md.include?(t), md)
Expand Down

0 comments on commit 3b8fae1

Please sign in to comment.