Medium difficulty temp. converter.
import codewars_test as test from solution import temperature_converter @test.describe("Example") def test_group(): @test.it("test case 1: fahrenheit_to_celsius") def test_case(): test.assert_equals(temperature_converter(0, "celsius"), -17.78) test.assert_equals(temperature_converter(32, "celsius"), 0) test.assert_equals(temperature_converter(76, "celsius"), 24.44) test.assert_equals(temperature_converter(112, "celsius"), 44.44) test.assert_equals(temperature_converter(-55, "celsius"), -48.33) @test.it("test case 2: celsius_to_fahrenheit") def test_case(): test.assert_equals(temperature_converter(0, "fahrenheit"), 32) test.assert_equals(temperature_converter(32, "fahrenheit"), 89.6) test.assert_equals(temperature_converter(48, "fahrenheit"), 118.4) test.assert_equals(temperature_converter(-17, "fahrenheit"), 1.4) test.assert_equals(temperature_converter(-55, "fahrenheit"), -67.0) @test.it("test case 3: both") def test_case(): test.assert_equals(temperature_converter(55, "both"), '12.78c, 131.0f') test.assert_equals(temperature_converter(100), '37.78c, 212.0f') test.assert_equals(temperature_converter(29), '-1.67c, 84.2f')
- import codewars_test as test
- from solution import temperature_converter
- @test.describe("Example")
- def test_group():
- @test.it("test case 1: fahrenheit_to_celsius")
- def test_case():
- test.assert_equals(temperature_converter(0, "celsius"), -17.78)
- test.assert_equals(temperature_converter(32, "celsius"), 0)
- test.assert_equals(temperature_converter(76, "celsius"), 24.44)
- test.assert_equals(temperature_converter(112, "celsius"), 44.44)
- test.assert_equals(temperature_converter(-55, "celsius"), -48.33)
- @test.it("test case 2: celsius_to_fahrenheit")
- def test_case():
- test.assert_equals(temperature_converter(0, "fahrenheit"), 32)
- test.assert_equals(temperature_converter(32, "fahrenheit"), 89.6)
- test.assert_equals(temperature_converter(48, "fahrenheit"), 118.4)
- test.assert_equals(temperature_converter(-17, "fahrenheit"), 1.4)
- test.assert_equals(temperature_converter(-55, "fahrenheit"), -67.0)
- @test.it("test case 3: both")
- def test_case():
- test.assert_equals(temperature_converter(55, "both"), '12.78c, 131.0f')
- test.assert_equals(temperature_converter(100), '37.78c, 212.0f')
- test.assert_equals(temperature_converter(29), '-1.67c, 84.2f')
This is a super simple challenge that requires you to change the value of a variable!
var a = 1;
//Change the Variable 'a' to 10;
// Since Node 10, we're using Mocha.
// You can use `chai` for assertions.
const chai = require("chai");
const assert = chai.assert;
// Uncomment the following line to disable truncating failure messages for deep equals, do:
// chai.config.truncateThreshold = 0;
// Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
// Uncomment the following to use the old assertions:
// const Test = require("@codewars/test-compat");
var a = 1;
describe("Solution", function() {
it("Change 'a' to 10", function() {
a = 10;
});
});