From f25950705732e18146978eef55f0a76d18260449 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Fri, 7 Nov 2025 13:36:40 +0100 Subject: [PATCH 1/2] Change protocol --- src/GeoTools/AbsoluteCoordinates.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GeoTools/AbsoluteCoordinates.class.st b/src/GeoTools/AbsoluteCoordinates.class.st index e0b3634..20ec91c 100644 --- a/src/GeoTools/AbsoluteCoordinates.class.st +++ b/src/GeoTools/AbsoluteCoordinates.class.st @@ -584,7 +584,7 @@ AbsoluteCoordinates >> copy [ ^copy ] -{ #category : #accessing } +{ #category : #testing } AbsoluteCoordinates >> isEmpty [ ^ self latitudeInDegrees isNil and: [ self longitudeInDegrees isNil and: [ self altitudeInMeters isNil ] ] From c6f7488f2a8cfb7fdb1c42aaa40c700ce1570c16 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Fri, 7 Nov 2025 18:24:39 +0100 Subject: [PATCH 2/2] - can randomize a Kinematics + tests --- .../AbsoluteCoordinatesTest.class.st | 8 ++++ src/GeoTools-Tests/KinematicsTests.class.st | 41 ++++++++++++------- src/GeoTools/Kinematics.class.st | 13 ++++++ 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st b/src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st index 97ef472..8b713f6 100644 --- a/src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st +++ b/src/GeoTools-Tests/AbsoluteCoordinatesTest.class.st @@ -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 +] diff --git a/src/GeoTools-Tests/KinematicsTests.class.st b/src/GeoTools-Tests/KinematicsTests.class.st index fc77154..abe0346 100644 --- a/src/GeoTools-Tests/KinematicsTests.class.st +++ b/src/GeoTools-Tests/KinematicsTests.class.st @@ -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. @@ -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. @@ -53,8 +62,7 @@ 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. @@ -62,8 +70,7 @@ KinematicsTests >> testCreate [ { #category : #tests } KinematicsTests >> testEdit [ - | kinematics | - kinematics := Kinematics new. + kinematics headingInRadians: 10. kinematics courseInRadians: 89. kinematics groundSpeedInMetersPerSecond: 50. @@ -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. @@ -103,8 +108,6 @@ KinematicsTests >> testGroundSpeed [ { #category : #tests } KinematicsTests >> testHeading [ - | kinematics | - kinematics := Kinematics new. kinematics headingInDegrees: 0. self assert: kinematics headingInDegrees equals: 0. @@ -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. +] diff --git a/src/GeoTools/Kinematics.class.st b/src/GeoTools/Kinematics.class.st index bb6a11d..e2006b0 100644 --- a/src/GeoTools/Kinematics.class.st +++ b/src/GeoTools/Kinematics.class.st @@ -13,6 +13,19 @@ Class { #category : #'GeoTools-Kinematics' } +{ #category : #'instance creation' } +Kinematics class >> random [ + + + | 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