Add solution directories for exercises

This commit is contained in:
thatblindgeye
2022-02-20 14:07:44 -05:00
parent 1971712fde
commit fb1a2db8d7
26 changed files with 600 additions and 0 deletions
@@ -0,0 +1,12 @@
const ftoc = function (f) {
return Math.round((f - 32) * (5 / 9) * 10) / 10;
};
const ctof = function (c) {
return Math.round(((c * 9) / 5 + 32) * 10) / 10;
};
module.exports = {
ftoc,
ctof,
};
@@ -0,0 +1,25 @@
const { ftoc, ctof } = require('./tempConversion-solution');
describe('ftoc', () => {
test('works', () => {
expect(ftoc(32)).toEqual(0);
});
test.skip('rounds to 1 decimal', () => {
expect(ftoc(100)).toEqual(37.8);
});
test.skip('works with negatives', () => {
expect(ftoc(-100)).toEqual(-73.3);
});
});
describe('ctof', () => {
test.skip('works', () => {
expect(ctof(0)).toEqual(32);
});
test.skip('rounds to 1 decimal', () => {
expect(ctof(73.2)).toEqual(163.8);
});
test.skip('works with negatives', () => {
expect(ctof(-10)).toEqual(14);
});
});