Skip to content

Instantly share code, notes, and snippets.

@basicxman
Created October 5, 2011 20:16
Show Gist options
  • Select an option

  • Save basicxman/1265555 to your computer and use it in GitHub Desktop.

Select an option

Save basicxman/1265555 to your computer and use it in GitHub Desktop.
class FractionsParsingTest < Test::Unit::TestCase
def test_complex_fractions
result = parse('(((x+2)(x-3)) / ((x-2)(x+2))) / (((x-1)(x-1))/((x-1)(x+1)))')
expected = '\dfrac{(x+2)(x-3)}{(x-2)(x+2)}\ \div\ \dfrac{(x-1)(x-1)}{(x-1)(x+1)}'
assert_equal expected, result
end
def test_single_complex_fraction
result = parse('(x^2+3) / (x^2-3)')
expected = '\dfrac{x^2+3}{x^2-3}'
assert_equal expected, result
end
def test_simple_fractions
result = parse('(x^2 -6+4)/(x^3)/(x^4)')
expected = '\dfrac{x^2-6+4}{\dfrac{x^3}{x^4}}'
assert_equal expected, result
end
def test_simple_fraction
result = parse('x/y')
expected = '\dfrac{x}{y}'
assert_equal expected, result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment