Fractional Input w/ Decimal Metric/Imp Converter

First I use eval in a get number function
and probably Fractional Input w/ Decimal it is 1/2 2.2 ```
It is not good test when I must guess

test('Fractional Input w/ Decimal', function(done) {
        var input = '1/2 w/ 0.5L';
  assert.equal(convertHandler.getNum(input),"invalid number");
and similar next 

(double fraction)’ I think is 1/2/2L

I tested when I put there 1/22.2mi I get 2 the eval from 1/22.2 make only 2
if I use num= Number.parseFloat(result) from 1/2 I get just 1.
and why is double fraction not needed in original if there is Math result of 1/2/2= 0.25?
let say the firsttests I let with parseFloat ,but than when fractions there must be eval used, so I am miss something?

I’m using eval as well. And I agree ‘double fraction’ is quite vague.

I have a different interpretation from you. I think it’s a safe assumption that the test is about preventing invalid input. Yes? But if eval can do the math, I’d say that’s valid input. So what kind of double fraction won’t evaluate that we’d want to protect against? In my opinion here’s a double fraction:


1 Like

Double backslash instead?

Nope, I think I’m wrong now- I saw one of the functional tests has this:


as invalid input.

I would guess that is the double fraction.

it s being a while when I make this thread, I cant remember what i s w/ in this test.

I am unsure if you got this figured out, but I ended up putting two fractions in one string: ‘3/7.2 5/4L’.