Skip to content

Commit

Permalink
i 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tonela10 committed May 14, 2024
1 parent c4572b7 commit 950c02a
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions implementation/tests.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
QUnit.test('convertIntegerToRoman Test Cases', function(assert) {
test("Example", function(assert) {
assert.propEqual(convertRomanToInteger("I"), {value: 1, message: '', result: true}, "TC-1");
});

QUnit.test("convertIntegerToRoman Test Cases", function(assert) {
// Test Cases for convertIntegerToRoman

// TC-1
assert.equal(convertIntegerToRoman(1), {value: 'I', message: '', result: true}, 'TC-1');
assert.propEqual(convertIntegerToRoman(1), {value: "I", message: '', result: true}, "TC-1");

// TC-2
assert.propEqual(convertIntegerToRoman(3999), {value: 'MMMCMXCIX', message: '', result: true}, 'TC-2');
assert.propEqual(convertIntegerToRoman(3999), {value: "MMMCMXCIX", message: '', result: true}, "TC-2");

// TC-3
assert.propEqual(convertIntegerToRoman(4000), {value: 0, message: 'Out of range (1-3999)', result: false}, 'TC-3');
assert.propEqual(convertIntegerToRoman(4000), {value: 0, message: 'Out of range (1-3999)', result: false}, "TC-3");

// TC-4
assert.propEqual(convertIntegerToRoman(0), {value: 0, message: 'Out of range (1-3999)', result: false}, 'TC-4');
assert.propEqual(convertIntegerToRoman(0), {value: 0, message: 'Out of range (1-3999)', result: false}, "TC-4");

// TC-5
assert.propEqual(convertIntegerToRoman(-100), {value: 0, message: 'Please enter a valid integer', result: false}, 'TC-5');
assert.propEqual(convertIntegerToRoman(-100), {value: 0, message: 'Please enter a valid integer', result: false}, "TC-5");

// TC-6
assert.propEqual(convertIntegerToRoman(3.14), {value: 0, message: 'Please enter a valid integer', result: false}, 'TC-6');
assert.propEqual(convertIntegerToRoman(3.14), {value: 0, message: 'Please enter a valid integer', result: false}, "TC-6");
});

QUnit.test('convertRomanToInteger Test Cases', function(assert) {
QUnit.test("convertRomanToInteger Test Cases", function(assert) {
// Test Cases for convertRomanToInteger

// TC-1
assert.propEqual(convertRomanToInteger('IV'), {value: 4, message: '', result: true}, 'TC-1');
assert.propEqual(convertRomanToInteger("IV"), {value: 4, message: '', result: true}, "TC-1");

// TC-2
assert.propEqual(convertRomanToInteger('MMMCMXCIX'), {value: 3999, message: '', result: true}, 'TC-2');
assert.propEqual(convertRomanToInteger("MMMCMXCIX"), {value: 3999, message: '', result: true}, "TC-2");

// TC-3
assert.propEqual(convertRomanToInteger(''), {value: 0, message: 'Please enter a valid roman', result: false}, 'TC-5');
assert.propEqual(convertRomanToInteger(""), {value: 0, message: 'Please enter a valid roman', result: false}, "TC-5");

// TC-4
assert.propEqual(convertRomanToInteger('X1V'), {value: 0, message: 'Please enter a valid roman', result: false}, 'TC-6');
assert.propEqual(convertRomanToInteger("X1V"), {value: 0, message: 'Please enter a valid roman', result: false}, "TC-6");

// TC-5
assert.propEqual(convertRomanToInteger('IIV'), {value: 0, message: 'Please enter a valid roman', result: false}, 'TC-7');
assert.propEqual(convertRomanToInteger("IIV"), {value: 0, message: 'Please enter a valid roman', result: false}, "TC-7");

// TC-6
assert.propEqual(convertRomanToInteger('iv'), {value: 4, message: '', result: true}, 'TC-8');
assert.propEqual(convertRomanToInteger("iv"), {value: 4, message: '', result: true}, "TC-8");
});

0 comments on commit 950c02a

Please sign in to comment.