UNPKG

1.01 kBJavaScriptView Raw
1var convert = require('../lib')
2 , assert = require('assert')
3 , tests = {};
4
5tests['C to K'] = function () {
6 assert.strictEqual( convert(0).from('C').to('K'), 273.15);
7};
8
9tests['K to C'] = function () {
10 assert.strictEqual( convert(273.15).from('K').to('C'), 0);
11};
12
13tests['F to C'] = function () {
14 assert.strictEqual( convert(32).from('F').to('C'), 0);
15};
16
17tests['C to F'] = function () {
18 assert.strictEqual( convert(0).from('C').to('F'), 32);
19};
20
21tests['F to K'] = function () {
22 assert.strictEqual( convert(32).from('F').to('K'), 273.15);
23};
24
25tests['F to R'] = function () {
26 assert.strictEqual( convert(100).from('F').to('R'), 559.6700000000001);
27};
28
29tests['R to F'] = function () {
30 assert.strictEqual( convert(670).from('R').to('F'), 210.32999999999998);
31};
32
33tests['R to C'] = function () {
34 assert.strictEqual( convert(612).from('R').to('C'), 66.85);
35};
36
37tests['R to K'] = function () {
38 assert.strictEqual( convert(459.67).from('R').to('K'), 255.3722222222222);
39};
40
41module.exports = tests;