-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_drone_searchrect.js
More file actions
35 lines (31 loc) · 1.1 KB
/
test_drone_searchrect.js
File metadata and controls
35 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Testscript für Drone.isPointInCurrentSearchRect
// Annahme: Drone-Klasse ist global verfügbar
// Dummy Coordinate-Klasse für Testzwecke
class Coordinate {
constructor(x, y, z = 0) {
this.x = x;
this.y = y;
this.z = z;
}
}
// Drohne mit Suchrechteck erzeugen
const drone = new Drone(1, 'Testdrone', 100, 'fire', { coordinate: new Coordinate(50, 8) });
drone.searchRect = {
north: 50.0,
south: 49.9,
east: 8.1,
west: 8.0
};
// Testpunkte
const testPoints = [
{ lat: 49.95, lng: 8.05, expected: true }, // innerhalb
{ lat: 50.1, lng: 8.05, expected: false }, // nördlich außerhalb
{ lat: 49.95, lng: 7.95, expected: false }, // westlich außerhalb
{ lat: 49.9, lng: 8.0, expected: true }, // exakt auf Süd/West-Ecke
{ lat: 50.0, lng: 8.1, expected: true } // exakt auf Nord/Ost-Ecke
];
console.log('--- Drone.isPointInCurrentSearchRect Test ---');
testPoints.forEach((pt, i) => {
const result = drone.isPointInCurrentSearchRect(pt);
console.log(`Test ${i + 1}:`, pt, '→', result, '| Erwartet:', pt.expected, '|', result === pt.expected ? 'OK' : 'FEHLER');
});