Finished 07_tempConversion

This commit is contained in:
Maganra 2022-07-05 15:36:18 -05:00
parent d2869d33d8
commit 6b172adb59
2 changed files with 11 additions and 9 deletions

View File

@ -1,9 +1,11 @@
const ftoc = function() {
const ftoc = function(fnum) {
ctemp = Math.round(((fnum - 32) * (5/9)) * 10) / 10;
return ctemp;
};
const ctof = function() {
const ctof = function(cnum) {
ftemp = Math.round(((cnum * (9/5)) + 32) * 10) / 10;
return ftemp;
};
// Do not edit below this line

View File

@ -4,22 +4,22 @@ describe('ftoc', () => {
test('works', () => {
expect(ftoc(32)).toEqual(0);
});
test.skip('rounds to 1 decimal', () => {
test('rounds to 1 decimal', () => {
expect(ftoc(100)).toEqual(37.8);
});
test.skip('works with negatives', () => {
test('works with negatives', () => {
expect(ftoc(-100)).toEqual(-73.3);
});
});
describe('ctof', () => {
test.skip('works', () => {
test('works', () => {
expect(ctof(0)).toEqual(32);
});
test.skip('rounds to 1 decimal', () => {
test('rounds to 1 decimal', () => {
expect(ctof(73.2)).toEqual(163.8);
});
test.skip('works with negatives', () => {
test('works with negatives', () => {
expect(ctof(-10)).toEqual(14);
});
});