Skip to content

Instantly share code, notes, and snippets.

@ivancorrales
Created February 8, 2021 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivancorrales/75b593a26f4df3469c3768a43e74fd5a to your computer and use it in GitHub Desktop.
Save ivancorrales/75b593a26f4df3469c3768a43e74fd5a to your computer and use it in GitHub Desktop.
# scenario-mult.hcl
scenario "operation multiplication" {
examples = [
{ x = 20, y = 10, multResult= 200},
{ x = -1, y = -2, multResult= 2},
{ x = 5, y = 5, multResult= 25},
{ x = 5, y = 0, multResult= 0},
]
given "initialie result" {
set result {
value = 0
}
}
when "multiply y by x" {
block {
set result {
value = result + x
}
print {
msg = "${x} * ${_.index+1} is ${result}"
}
count = y
when = x>0 && y>0
}
set result {
value = x * y
when = x<0 || y<0
}
}
then "the result of the operation is the expected" {
assert {
assertion = result==multResult
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment