Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,11 @@ AbsoluteCoordinatesTest >> testIsZero [
self assert: coord isLatLonZero.
self assert: coord isZero.
]

{ #category : #tests }
AbsoluteCoordinatesTest >> testRandom [

| coordinates |
coordinates := AbsoluteCoordinates random.
self assert: coordinates isNotEmpty
]
41 changes: 27 additions & 14 deletions src/GeoTools-Tests/KinematicsTests.class.st
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
Class {
#name : #KinematicsTests,
#superclass : #TestCase,
#instVars : [
'kinematics'
],
#category : #'GeoTools-Tests-Kinematics'
}

{ #category : #running }
KinematicsTests >> setUp [

super setUp.

kinematics := Kinematics new
]

{ #category : #tests }
KinematicsTests >> testCopy [
| kinematics copy |
kinematics := Kinematics new.
| copy |

kinematics headingInRadians: 10.
kinematics courseInRadians: 89.
kinematics groundSpeedInMetersPerSecond: 50.
Expand All @@ -31,9 +42,7 @@ KinematicsTests >> testCopy [

{ #category : #tests }
KinematicsTests >> testCourse [
| kinematics |
kinematics := Kinematics new.


kinematics courseInDegrees: 0.
self assert: kinematics courseInDegrees equals: 0.
self assert: kinematics courseInRadians equals: 0.
Expand All @@ -53,17 +62,15 @@ KinematicsTests >> testCourse [

{ #category : #tests }
KinematicsTests >> testCreate [
| kinematics |
kinematics := Kinematics new.

self assert: kinematics course isNil.
self assert: kinematics groundSpeed isNil.
self assert: kinematics heading isNil.
]

{ #category : #tests }
KinematicsTests >> testEdit [
| kinematics |
kinematics := Kinematics new.

kinematics headingInRadians: 10.
kinematics courseInRadians: 89.
kinematics groundSpeedInMetersPerSecond: 50.
Expand All @@ -81,9 +88,7 @@ KinematicsTests >> testEdit [

{ #category : #tests }
KinematicsTests >> testGroundSpeed [
| kinematics |
kinematics := Kinematics new.


kinematics groundSpeedInMetersPerSecond: 0.
self assert: kinematics groundSpeedInMetersPerSecond equals: 0.
self assert: kinematics groundSpeedInKnots equals: 0.
Expand All @@ -103,8 +108,6 @@ KinematicsTests >> testGroundSpeed [

{ #category : #tests }
KinematicsTests >> testHeading [
| kinematics |
kinematics := Kinematics new.

kinematics headingInDegrees: 0.
self assert: kinematics headingInDegrees equals: 0.
Expand All @@ -122,3 +125,13 @@ KinematicsTests >> testHeading [
self assert: kinematics headingInDegrees equals: 28.64788975654116.
self assert: kinematics headingInRadians equals: 0.5.
]

{ #category : #tests }
KinematicsTests >> testRandom [

kinematics := Kinematics random.

self assert: kinematics course notNil.
self assert: kinematics groundSpeed notNil.
self assert: kinematics heading notNil.
]
2 changes: 1 addition & 1 deletion src/GeoTools/AbsoluteCoordinates.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ AbsoluteCoordinates >> copy [
^copy
]

{ #category : #accessing }
{ #category : #testing }
AbsoluteCoordinates >> isEmpty [

^ self latitudeInDegrees isNil and: [ self longitudeInDegrees isNil and: [ self altitudeInMeters isNil ] ]
Expand Down
13 changes: 13 additions & 0 deletions src/GeoTools/Kinematics.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ Class {
#category : #'GeoTools-Kinematics'
}

{ #category : #'instance creation' }
Kinematics class >> random [

<script: 'self random inspect'>
| random kinematics |
random := Random new.
kinematics := self new.
kinematics courseInDegrees: ((random next * 360) % 360).
kinematics groundSpeedInMetersPerSecond: (random next * 10).
kinematics headingInDegrees: ((random next * 360) % 360).
^ kinematics
]

{ #category : #copying }
Kinematics >> = aKinematics [
^ self course = aKinematics course
Expand Down