47 lines
2.1 KiB
C++

#include <cassert>
#include "Verkehrsmittel.h"
#include "Luftfahrzeug.h"
#include "Radfahrzeug.h"
#include "PKW.h"
int main()
{
//Verkehrsmittel
Verkehrsmittel verkehrsmittel;
cout << verkehrsmittel.text() << endl;
assert(verkehrsmittel.text().compare("Verkehrsmittel - Position x: 0; Position y: 0") == 0 && "String must be: Verkehrsmittel - Position x: 0; Position y: 0");
verkehrsmittel.bewege(10,10);
cout << verkehrsmittel.text() << endl;
assert(verkehrsmittel.text().compare("Verkehrsmittel - Position x: 10; Position y: 10") == 0 && "String must be: Verkehrsmittel - Position x: 10; Position y: 10");
//Luftfahrzeug
Luftfahrzeug luft(10000);
cout << luft.text() << endl;
assert(luft.text().compare("Luftfahrzeug - Position x: 0; Position y: 0; max. Höhe: 10000") == 0 &&
"String must be: Luftfahrzeug - Position x: 0; Position y: 0; max. Höhe: 10000");
luft.bewege(11,11);
cout << luft.text() << endl;
assert(luft.text().compare("Luftfahrzeug - Position x: 11; Position y: 11; max. Höhe: 10000") == 0 &&
"String must be: Luftfahrzeug - Position x: 11; Position y: 11; max. Höhe: 10000");
//Radfahrzeug
Radfahrzeug rad(4);
cout << rad.text() << endl;
assert(rad.text().compare("Radfahrzeug - Position x: 0; Position y: 0; Anzahl Räder: 4") == 0 &&
"String must be: Radfahrzeug - Position x: 0; Position y: 0; Anzahl Räder: 4");
rad.bewege(14,14);
cout << rad.text() << endl;
assert(rad.text().compare("Radfahrzeug - Position x: 14; Position y: 14; Anzahl Räder: 4") == 0 &&
"String must be: Radfahrzeug - Position x: 14; Position y: 14; Anzahl Räder: 4");
//PKW
PKW pkw(4, 5);
cout << pkw.text() << endl;
assert(pkw.text().compare("PKW - Position x: 0; Position y: 0; Anzahl Räder: 4; Anzahl Türen: 5") == 0 &&
"String must be: PKW - Position x: 0; Position y: 0; Anzahl Räder: 4; Anzahl Türen: 5");
pkw.bewege(-11,-11);
cout << pkw.text() << endl;
assert(pkw.text().compare("PKW - Position x: -11; Position y: -11; Anzahl Räder: 4; Anzahl Türen: 5") == 0 &&
"String must be: PKW - Position x: -11; Position y: -11; Anzahl Räder: 4; Anzahl Türen: 5");
}