~toshaevil/stellarium/new-keybindings

« back to all changes in this revision

Viewing changes to src/tests/testRefractionExtinction.cpp

  • Committer: toshaevil
  • Date: 2012-09-08 14:01:04 UTC
  • mfrom: (5299.1.299 trunk)
  • Revision ID: toshaevil@gmail.com-20120908140104-lcw0qez8tn347z3n
merge with trunk; fix little bug with adding telescope plugins shortcuts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Stellarium
3
 
 * Copyright (C) 2010 Fabien Chereau
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
 
20
 
#include <QObject>
21
 
#include <QtDebug>
22
 
#include <QtTest>
23
 
 
24
 
#include "tests/testRefractionExtinction.hpp"
25
 
 
26
 
QTEST_MAIN(TestRefractionExtinction)
27
 
 
28
 
void TestRefractionExtinction::initTestCase()
29
 
{
30
 
}
31
 
 
32
 
void TestRefractionExtinction::testBase()
33
 
{
34
 
        RefractionExtinction refExt;
35
 
        Vec3d v(1.,0.,0.);
36
 
        float mag=4.f;
37
 
        refExt.forward(&v, &mag, 1);
38
 
        QVERIFY(mag>=4.);
39
 
        QVERIFY(v[2]>=0);
40
 
 
41
 
 
42
 
        Vec3d vert(0.,0.,1.);
43
 
        mag=2.0f;
44
 
        refExt.setExtinctionCoefficient(0.25);
45
 
        refExt.setTemperature(15.0);
46
 
        refExt.setPressure(1000.0);
47
 
        refExt.forward(&vert, &mag, 1);
48
 
        QVERIFY(mag==2.25);
49
 
        QVERIFY(vert[2]==1.0);
50
 
 
51
 
        Vec3d neg(std::sqrt(2.0),0.,std::sqrt(2.0));
52
 
        mag=2.0f;
53
 
        refExt.forward(&neg, &mag, 1);
54
 
        QVERIFY(mag==2.0);
55
 
        QVERIFY(neg[2]==std::sqrt(2.0));
56
 
}
57
 
 
58
 
void TestRefractionExtinction::benchmark()
59
 
{
60
 
}