Skip to content

Commit

Permalink
improve examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornregnell committed Jan 13, 2025
1 parent 67a8ea7 commit 3ae0a5e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/main/scala/06-examples.scala
Original file line number Diff line number Diff line change
Expand Up @@ -284,25 +284,25 @@ object Prioritization:
val DollarTest = Model(
Stakeholder("a").has(
Prio(2),
Req("1") has Benefit(5),
Req("2") has Benefit(300),
Req("3") has Benefit(8),
Req("4") has Benefit(9),
Req("5") has Benefit(100),
Req("6") has Benefit(10),
Req("7") has Benefit(20)),
Req("r1") has Benefit(5),
Req("r2") has Benefit(300),
Req("r3") has Benefit(8),
Req("r4") has Benefit(9),
Req("r5") has Benefit(100),
Req("r6") has Benefit(10),
Req("r7") has Benefit(20)),
Stakeholder("b").has(
Prio(4),
Req("1") has Benefit(100),
Req("2") has Benefit(7),
Req("3") has Benefit(20),
Req("4") has Benefit(80),
Req("5") has Benefit(10),
Req("6") has Benefit(90),
Req("7") has Benefit(20)))
Req("r1") has Benefit(100),
Req("r2") has Benefit(7),
Req("r3") has Benefit(20),
Req("r4") has Benefit(80),
Req("r5") has Benefit(10),
Req("r6") has Benefit(90),
Req("r7") has Benefit(20)))

def normalizedVotes(
m: Model = DollarTest,
m: Model,
voterType: EntType = Stakeholder,
voterPrioType: IntAttrType = Prio,
requirementType: EntType = Req,
Expand Down
3 changes: 2 additions & 1 deletion src/test/scala/TestModelOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class TestModelOps extends munit.FunSuite:
assert(m.sortLeafRelsBy(Prio).toModel.withRank(Order).toModel.sortLeafRelsBy(Order) == m.sortLeafRelsBy(Order))

test("Model Examples "):
assert(examples.Prioritization.normalizedVotes().intValues.sum == 99)
import examples.Prioritization.*
assert(normalizedVotes(DollarTest).intValues.sum == 99)



0 comments on commit 3ae0a5e

Please sign in to comment.