go-pattern-examples/behavior/17_memento/memento_test.go

23 lines
278 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package memento
func ExampleGame() {
game := &Game{
hp: 10,
mp: 10,
}
game.Status()
progress := game.Save()
game.Play(-2, -3)
game.Status()
game.Load(progress)
game.Status()
// Output:
// Current HP:10, MP:10
// Current HP:7, MP:8
// Current HP:10, MP:10
}