tempConversion all done
This commit is contained in:
parent
8bc9e3dc90
commit
da6a5737cb
|
@ -1,12 +1,24 @@
|
|||
const ftoc = function() {
|
||||
const ftoc = function(fValue) {
|
||||
|
||||
let result = 0.0;
|
||||
|
||||
//Convert Farenheit to Celsius
|
||||
result = Math.round(((fValue - 32) * 5 / 9) * 10) / 10;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const ctof = function() {
|
||||
const ctof = function(cValue) {
|
||||
let result = 0.0;
|
||||
|
||||
//Convert Celsius to Farenheit
|
||||
result = Math.round(((cValue * 9 / 5) + 32) * 10) / 10;
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ftoc,
|
||||
ctof
|
||||
ftoc,
|
||||
ctof
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
const {ftoc, ctof} = require('./tempConversion')
|
||||
const { ftoc, ctof } = require('./tempConversion')
|
||||
|
||||
describe('ftoc', function() {
|
||||
it('works', function() {
|
||||
expect(ftoc(32)).toEqual(0);
|
||||
});
|
||||
xit('rounds to 1 decimal', function() {
|
||||
expect(ftoc(100)).toEqual(37.8);
|
||||
});
|
||||
xit('works with negatives', function() {
|
||||
expect(ftoc(-100)).toEqual(-73.3);
|
||||
});
|
||||
it('works', function() {
|
||||
expect(ftoc(32)).toEqual(0);
|
||||
});
|
||||
it('rounds to 1 decimal', function() {
|
||||
expect(ftoc(100)).toEqual(37.8);
|
||||
});
|
||||
it('works with negatives', function() {
|
||||
expect(ftoc(-100)).toEqual(-73.3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ctof', function() {
|
||||
xit('works', function() {
|
||||
expect(ctof(0)).toEqual(32);
|
||||
});
|
||||
xit('rounds to 1 decimal', function() {
|
||||
expect(ctof(73.2)).toEqual(163.8);
|
||||
});
|
||||
xit('works with negatives', function() {
|
||||
expect(ctof(-10)).toEqual(14);
|
||||
});
|
||||
it('works', function() {
|
||||
expect(ctof(0)).toEqual(32);
|
||||
});
|
||||
it('rounds to 1 decimal', function() {
|
||||
expect(ctof(73.2)).toEqual(163.8);
|
||||
});
|
||||
it('works with negatives', function() {
|
||||
expect(ctof(-10)).toEqual(14);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue