1 #include "platformtest.h"
4 void PlatformTest::init()
6 qDebug() << "Creating efA and efB.";
7 //efA = new EmuFrontFile(1, "a", "qa", 1, 2);
8 //efB = new EmuFrontFile(2, "b", "qaa", 2, 3);
11 void PlatformTest::initTestCase()
13 qDebug() << "Initializing PlatformTest.";
16 void PlatformTest::cleanup()
18 qDebug() << "cleanup";
19 // The following objects have already been deleted
26 void PlatformTest::cleanupTestCase()
28 qDebug() << "Cleaning up PlatformTest.";
31 /*void PlatformTest::equals_data()
33 qDebug() << "Arranging data for equals.";
35 QTest::addColumn<Platform>("platform1");
36 QTest::addColumn<Platform>("platform2");
37 qDebug() << "Done columns";
38 efA = new EmuFrontFile(1, "a", "qa", 1, 2);
39 efB = new EmuFrontFile(2, "b", "qaa", 2, 3);
40 qDebug() << "efA" << efA->getName();
41 qDebug() << "efB" << efB->getName();
43 QTest::newRow("id and name")
44 << Platform(1, "test", efA)
45 << Platform(1, "test", efB);
47 qDebug() << "Done first row";
48 efA = new EmuFrontFile(1, "a", "qa", 1, 2);
49 efB = new EmuFrontFile(2, "b", "qaa", 2, 3);
50 qDebug() << "efA" << efA->getName();
51 qDebug() << "efB" << efB->getName();
53 QTest::newRow("id, name and filename")
54 << Platform(2, "test", efA)
55 << Platform(2, "test", efB);
56 qDebug() << "Done 2nd row";
59 void PlatformTest::equals()
61 qDebug() << "Entering equals";
62 QFETCH(Platform, platform1);
63 QFETCH(Platform, platform2);
64 QVERIFY(platform1 == platform2);
65 qDebug() << "Leaving equals";
68 void PlatformTest::equals2()
70 qDebug() << "Starting equals2";
71 EmuFrontFile *efA = new EmuFrontFile(1, "a", "qa", 1, 2);
72 EmuFrontFile *efB = new EmuFrontFile(2, "b", "qaa", 2, 3);
73 Platform p1(1, "test");
74 Platform p2(1, "test");
77 qDebug() << "efA" << efA->getName();
78 qDebug() << "efB" << efB->getName();
80 Platform p5(1, "test", efA);
81 // The following cannot be done, efA dies with p5:
82 // and pointer from p6 would keep pointing to memory area where
83 // efA no longer exists:
84 //Platform p6(1, "test", efA);
85 Platform p6(1, "test", efB);
87 qDebug() << "efA" << efA->getName();
88 qDebug() << "efB" << efB->getName();
91 qDebug() << "Entering QVERIFY";
94 qDebug() << "efA" << efA->getName();
95 qDebug() << "efB" << efB->getName();
99 qDebug() << "efA" << efA->getName();
100 qDebug() << "efB" << efB->getName();
102 qDebug() << "Leaving QVERIFY";
103 qDebug() << "Leaving equals2";
108 /* Platforms are equal if the following fields match:
113 /*void PlatformTest::notEquals()
115 Platform p1(1, "testa");
116 Platform p2(1, "test");
117 // This should return true