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
36
37
38
39
40
41
42
43
44
45
46
|
import QtQuick 2.0
import QtTest 1.0
import "../harbour-unitmaster/qml/pages"
TestCase {
name: "PressureModelTest"
PressureModel {
id: model
}
function test_to_data() {
return [
{ to: "kilopascal", value: 1234, res: 1.234 },
{ to: "bar", value: 1, res: 1e-5 },
{ to: "millibar", value: 1, res: 0.01 },
{ to: "pounds per square inch", value: 1, res: 1.450377e-4 },
{ to: "technical atmosphere", value: 1, res: 1.0197e-5 },
{ to: "standard atmosphere", value: 1, res: 9.8692e-6 },
{ to: "torr", value: 1, res: 7.5006e-3 }
];
}
function test_to(data) {
var result = model.to(data.to, data.value);
compare(result, data.res);
}
function test_from_data() {
return [
{ from: "kilopascal", value: 1, res: 1000 },
{ from: "bar", value: 1, res: 1e5 },
{ from: "millibar", value: 1, res: 100 },
{ from: "pounds per square inch", value: 1, res: 6.8948e3 },
{ from: "technical atmosphere", value: 1, res: 0.980665e5 },
{ from: "standard atmosphere", value: 1, res: 1.01325e5 },
{ from: "torr", value: 1, res: 133.3224 }
];
}
function test_from(data) {
var result = model.from(data.from, data.value);
compare(result, data.res);
}
}
|