-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pavel Lakosnikov
committed
Aug 28, 2020
1 parent
6572c93
commit f580220
Showing
3 changed files
with
50 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package physics | ||
|
||
import ( | ||
"github.com/faiface/pixel" | ||
object "github.com/shamanr/battle_citty/scene/objects" | ||
"testing" | ||
) | ||
|
||
func Test_isMoving(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
vec pixel.Vec | ||
want bool | ||
}{ | ||
{ | ||
name: "Двигается!", | ||
vec: pixel.V(10000, -3000), | ||
want: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
obj := object.Object{} | ||
obj.SetSpeed(&tt.vec) | ||
if got := isMoving(&obj); got != tt.want { | ||
t.Errorf("isMoving() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters