Skip to content

Commit

Permalink
add additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKam committed Jun 30, 2024
1 parent 7da6b4d commit 0c6a121
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions spec/src/agent/Agent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,34 @@ describe('Agent / next(), configuration object-based', () => {
newAgent.next(newBeliefs2)
expect(newAgent.beliefs.isSlippery.value).toBe(false)
})

it('should correctly execute the EUMAS 2024 paper example', () => {
const beliefs = {
...Belief('isRaining', false),
...Belief('isSlippery', false)
}

const plans = [
Plan(
beliefs => beliefs.isRaining,
() => [{ action: 'take_umbrella' }]
),
Plan(
beliefs => beliefs.isSlippery,
() => [{ action: 'dress_shoes_with_profile' }]
)
]

const newAgent = new Agent('myAgent', beliefs, {}, plans)
expect(newAgent.next({ ...Belief('isRaining', true) })[0][0].action).toEqual('take_umbrella')

const update = {
...Belief('isRaining', true, 1),
...Belief('isSlippery', true, 0)
}
const execution = newAgent.next(update)
expect(execution[0][0].action).toEqual('take_umbrella')
expect(execution[1][0].action).toEqual('dress_shoes_with_profile')

})
})

0 comments on commit 0c6a121

Please sign in to comment.