Bläddra i källkod

vector tests; removed binary files; gitignore

develop
Robin Thoni 8 år sedan
förälder
incheckning
d4b277472a
4 ändrade filer med 40 tillägg och 99 borttagningar
  1. 2
    0
      .gitignore
  2. Binär
      tests/tests
  3. 38
    4
      tests/testvector3d.cpp
  4. 0
    95
      tests/testvector3d.moc

+ 2
- 0
.gitignore Visa fil

@@ -2,6 +2,7 @@
2 2
 
3 3
 ui_*
4 4
 moc_*
5
+*.moc
5 6
 
6 7
 Makefile
7 8
 
@@ -9,3 +10,4 @@ Makefile
9 10
 *.so
10 11
 *.so.*
11 12
 TheGame/TheGame
13
+tests/tests

Binär
tests/tests Visa fil


+ 38
- 4
tests/testvector3d.cpp Visa fil

@@ -8,6 +8,9 @@ class TestVector3D : public QObject
8 8
 private slots:
9 9
     void gettersSetters1();
10 10
     void gettersSetters2();
11
+    void gettersSetters3();
12
+    void mult();
13
+    void div();
11 14
 };
12 15
 
13 16
 void TestVector3D::gettersSetters1()
@@ -20,10 +23,41 @@ void TestVector3D::gettersSetters1()
20 23
 
21 24
 void TestVector3D::gettersSetters2()
22 25
 {
23
-    Vector3D v(1.42, 2.0, 3.0);
24
-    QCOMPARE(v.getX(), 1.42);
25
-    QCOMPARE(v.getY(), 2.0);
26
-    QCOMPARE(v.getZ(), 3.0);
26
+    double x = 1.42, y = 2.0, z = 3.0;
27
+    Vector3D v(x, y, z);
28
+    QCOMPARE(v.getX(), x);
29
+    QCOMPARE(v.getY(), y);
30
+    QCOMPARE(v.getZ(), z);
31
+}
32
+
33
+void TestVector3D::gettersSetters3()
34
+{
35
+    double x = 1.42, y = 2.0, z = 3.0;
36
+    Vector3D v;
37
+    v.setX(x).setY(y).setZ(z);
38
+    QCOMPARE(v.getX(), x);
39
+    QCOMPARE(v.getY(), y);
40
+    QCOMPARE(v.getZ(), z);
41
+}
42
+
43
+void TestVector3D::mult()
44
+{
45
+    double x = 1.42, y = 2.0, z = 3.0, m = 2.0;
46
+    Vector3D v(x, y, z);
47
+    v.mult(m);
48
+    QCOMPARE(v.getX(), x * m);
49
+    QCOMPARE(v.getY(), y * m);
50
+    QCOMPARE(v.getZ(), z * m);
51
+}
52
+
53
+void TestVector3D::div()
54
+{
55
+    double x = 1.42, y = 2.0, z = 3.0, m = 2.0;
56
+    Vector3D v(x, y, z);
57
+    v.div(m);
58
+    QCOMPARE(v.getX(), x / m);
59
+    QCOMPARE(v.getY(), y / m);
60
+    QCOMPARE(v.getZ(), z / m);
27 61
 }
28 62
 
29 63
 QTEST_MAIN(TestVector3D)

+ 0
- 95
tests/testvector3d.moc Visa fil

@@ -1,95 +0,0 @@
1
-/****************************************************************************
2
-** Meta object code from reading C++ file 'testvector3d.cpp'
3
-**
4
-** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6)
5
-**
6
-** WARNING! All changes made in this file will be lost!
7
-*****************************************************************************/
8
-
9
-#if !defined(Q_MOC_OUTPUT_REVISION)
10
-#error "The header file 'testvector3d.cpp' doesn't include <QObject>."
11
-#elif Q_MOC_OUTPUT_REVISION != 63
12
-#error "This file was generated using the moc from 4.8.6. It"
13
-#error "cannot be used with the include files from this version of Qt."
14
-#error "(The moc has changed too much.)"
15
-#endif
16
-
17
-QT_BEGIN_MOC_NAMESPACE
18
-static const uint qt_meta_data_TestVector3D[] = {
19
-
20
- // content:
21
-       6,       // revision
22
-       0,       // classname
23
-       0,    0, // classinfo
24
-       2,   14, // methods
25
-       0,    0, // properties
26
-       0,    0, // enums/sets
27
-       0,    0, // constructors
28
-       0,       // flags
29
-       0,       // signalCount
30
-
31
- // slots: signature, parameters, type, tag, flags
32
-      14,   13,   13,   13, 0x08,
33
-      32,   13,   13,   13, 0x08,
34
-
35
-       0        // eod
36
-};
37
-
38
-static const char qt_meta_stringdata_TestVector3D[] = {
39
-    "TestVector3D\0\0gettersSetters1()\0"
40
-    "gettersSetters2()\0"
41
-};
42
-
43
-void TestVector3D::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
44
-{
45
-    if (_c == QMetaObject::InvokeMetaMethod) {
46
-        Q_ASSERT(staticMetaObject.cast(_o));
47
-        TestVector3D *_t = static_cast<TestVector3D *>(_o);
48
-        switch (_id) {
49
-        case 0: _t->gettersSetters1(); break;
50
-        case 1: _t->gettersSetters2(); break;
51
-        default: ;
52
-        }
53
-    }
54
-    Q_UNUSED(_a);
55
-}
56
-
57
-const QMetaObjectExtraData TestVector3D::staticMetaObjectExtraData = {
58
-    0,  qt_static_metacall 
59
-};
60
-
61
-const QMetaObject TestVector3D::staticMetaObject = {
62
-    { &QObject::staticMetaObject, qt_meta_stringdata_TestVector3D,
63
-      qt_meta_data_TestVector3D, &staticMetaObjectExtraData }
64
-};
65
-
66
-#ifdef Q_NO_DATA_RELOCATION
67
-const QMetaObject &TestVector3D::getStaticMetaObject() { return staticMetaObject; }
68
-#endif //Q_NO_DATA_RELOCATION
69
-
70
-const QMetaObject *TestVector3D::metaObject() const
71
-{
72
-    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
73
-}
74
-
75
-void *TestVector3D::qt_metacast(const char *_clname)
76
-{
77
-    if (!_clname) return 0;
78
-    if (!strcmp(_clname, qt_meta_stringdata_TestVector3D))
79
-        return static_cast<void*>(const_cast< TestVector3D*>(this));
80
-    return QObject::qt_metacast(_clname);
81
-}
82
-
83
-int TestVector3D::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
84
-{
85
-    _id = QObject::qt_metacall(_c, _id, _a);
86
-    if (_id < 0)
87
-        return _id;
88
-    if (_c == QMetaObject::InvokeMetaMethod) {
89
-        if (_id < 2)
90
-            qt_static_metacall(this, _c, _id, _a);
91
-        _id -= 2;
92
-    }
93
-    return _id;
94
-}
95
-QT_END_MOC_NAMESPACE

Laddar…
Avbryt
Spara