mathematical 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/ext/mathematical/extconf.rb +6 -1
  3. data/ext/mathematical/lasem/src/lsmdomcharacterdata.c +17 -0
  4. data/ext/mathematical/lasem/src/lsmdomdocument.c +17 -0
  5. data/ext/mathematical/lasem/src/lsmmathmlfencedelement.c +8 -6
  6. data/ext/mathematical/lasem/src/lsmmathmloperatorelement.c +8 -6
  7. data/ext/mathematical/lasem/src/lsmmathmlview.c +12 -7
  8. data/ext/mathematical/lasem/src/lsmmathmlview.h +2 -0
  9. data/ext/mathematical/lasem/src/lsmsvgsymbolelement.c +74 -0
  10. data/ext/mathematical/lasem/src/lsmsvgsymbolelement.h +3 -0
  11. data/ext/mathematical/lasem/src/lsmsvguseelement.c +10 -9
  12. data/ext/mathematical/lasem/src/lsmsvgview.c +12 -0
  13. data/ext/mathematical/lasem/src/lsmsvgview.h +1 -0
  14. data/ext/mathematical/lasem/tests/lsmtest.c +1 -1
  15. data/ext/mathematical/lasem/tests/suite.c +18 -1
  16. data/ext/mathematical/mtex2MML/src/lex.yy.c +4454 -4090
  17. data/ext/mathematical/mtex2MML/src/mtex2MML.h +1 -0
  18. data/ext/mathematical/mtex2MML/src/parse_extras.c +176 -41
  19. data/ext/mathematical/mtex2MML/src/parse_extras.h +30 -8
  20. data/ext/mathematical/mtex2MML/src/string_extras.c +5 -26
  21. data/ext/mathematical/mtex2MML/src/string_extras.h +1 -6
  22. data/ext/mathematical/mtex2MML/src/y.tab.c +6600 -5492
  23. data/ext/mathematical/mtex2MML/src/y.tab.h +572 -525
  24. data/lib/mathematical/version.rb +1 -1
  25. data/mathematical.gemspec +1 -1
  26. data/test/mathematical/basic_test.rb +1 -1
  27. data/test/mathematical/corrections_test.rb +1 -1
  28. data/test/mathematical/fixtures_test.rb +1 -1
  29. data/test/mathematical/maliciousness_test.rb +17 -17
  30. data/test/mathematical/mathjax_test.rb +2 -3
  31. data/test/mathematical/mathml_test.rb +1 -1
  32. data/test/mathematical/multiples_test.rb +1 -1
  33. data/test/mathematical/performance_test.rb +6 -8
  34. data/test/mathematical/png_test.rb +1 -1
  35. data/test/test_helper.rb +2 -2
  36. metadata +6 -6
@@ -1,3 +1,3 @@
1
1
  class Mathematical
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
data/mathematical.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rake', '~> 0.9'
25
25
  spec.add_development_dependency 'rake-compiler', '~> 0.9'
26
26
  spec.add_development_dependency 'bundler', '~> 1.5'
27
- spec.add_development_dependency 'mocha', '~> 1.0'
27
+ spec.add_development_dependency 'minitest', '~> 5.6'
28
28
  spec.add_development_dependency 'math-to-itex', '0.3.0'
29
29
  spec.add_development_dependency 'nokogiri', '~> 1.6'
30
30
  end
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::BasicTest < Test::Unit::TestCase
3
+ class Mathematical::BasicTest < MiniTest::Test
4
4
 
5
5
  def test_it_has_a_version
6
6
  assert Mathematical::VERSION
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::CorrectionsTest < Test::Unit::TestCase
3
+ class Mathematical::CorrectionsTest < MiniTest::Test
4
4
 
5
5
  def setup
6
6
  @render = Mathematical.new
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::FixturesTest < Test::Unit::TestCase
3
+ class Mathematical::FixturesTest < MiniTest::Test
4
4
  # the same SVGs sometimes get random id values, throwing off the tests
5
5
  def strip_id(blob)
6
6
  blob.gsub(/id="surface.+?"/, '')
@@ -1,55 +1,55 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::MaliciousnessTest < Test::Unit::TestCase
3
+ class Mathematical::MaliciousnessTest < MiniTest::Test
4
4
 
5
5
  def test_it_does_not_error_on_unrecognized_commands
6
6
  render = Mathematical.new
7
7
  output = nil
8
8
  # In mtex2MML, we raise a ParseError, but Mathematical suppresses it and returns the string.
9
- assert_nothing_raised { output = render.render('$not__thisisnotreal$') }
9
+ output = render.render('$not__thisisnotreal$')
10
10
  assert_equal output[:data], '$not__thisisnotreal$'
11
11
  assert_equal output[:exception].class, Mathematical::ParseError
12
12
  end
13
13
 
14
14
  def test_it_does_not_blow_up_on_bad_arguments
15
15
  # need to pass a hash here
16
- assert_raise TypeError do
16
+ assert_raises TypeError do
17
17
  render = Mathematical.new("not a hash")
18
18
  end
19
19
 
20
20
  # need to pass a string here
21
21
  render = Mathematical.new
22
- assert_raise TypeError do
22
+ assert_raises TypeError do
23
23
  Mathematical.new.render(123)
24
24
  end
25
25
  end
26
26
 
27
27
  def test_it_does_not_blow_up_on_bad_options
28
- assert_raise TypeError do
28
+ assert_raises TypeError do
29
29
  Mathematical.new({:ppi => 'not a number'})
30
30
  end
31
31
 
32
- assert_raise TypeError do
32
+ assert_raises TypeError do
33
33
  render = Mathematical.new({:zoom => 'not a number'})
34
34
  end
35
35
 
36
- assert_raise TypeError do
36
+ assert_raises TypeError do
37
37
  Mathematical.new({:maxsize => 'not a number'})
38
38
  end
39
39
 
40
- assert_raise TypeError do
40
+ assert_raises TypeError do
41
41
  Mathematical.new({:maxsize => -23})
42
42
  end
43
43
 
44
- assert_raise TypeError do
44
+ assert_raises TypeError do
45
45
  Mathematical.new({:maxsize => 5.3})
46
46
  end
47
47
 
48
- assert_raise TypeError do
48
+ assert_raises TypeError do
49
49
  Mathematical.new({:format => 123})
50
50
  end
51
51
 
52
- assert_raise TypeError do
52
+ assert_raises TypeError do
53
53
  Mathematical.new({:format => 'something amazing'})
54
54
  end
55
55
 
@@ -58,27 +58,27 @@ class Mathematical::MaliciousnessTest < Test::Unit::TestCase
58
58
  assert_equal output[:data], '$a \ne b$'
59
59
  assert_equal output[:exception].class, Mathematical::MaxsizeError
60
60
 
61
- assert_raise RangeError do
61
+ assert_raises RangeError do
62
62
  render = Mathematical.new({ :maxsize => 4_294_967_295 }) # unsigned long max
63
63
  render.render('$a \ne b$')
64
64
  end
65
65
  end
66
66
 
67
67
  def test_it_does_not_blow_up_on_bad_input
68
- assert_raise TypeError do
68
+ assert_raises TypeError do
69
69
  Mathematical.new.render(23)
70
70
  end
71
71
 
72
- assert_raise ArgumentError do
72
+ assert_raises ArgumentError do
73
73
  Mathematical.new.render('No dollars')
74
74
  end
75
75
 
76
- assert_raise ArgumentError do
76
+ assert_raises ArgumentError do
77
77
  array = %w(foof poof)
78
78
  Mathematical.new.render(array)
79
79
  end
80
80
 
81
- assert_raise ArgumentError do
81
+ assert_raises ArgumentError do
82
82
  array = ['$foof$', nil, '$poof$']
83
83
  Mathematical.new.render(array)
84
84
  end
@@ -89,7 +89,7 @@ class Mathematical::MaliciousnessTest < Test::Unit::TestCase
89
89
  output = nil
90
90
  # Much like above, this fails in mtx2MML, but should do nothing here
91
91
  text = '$\Huge \sqrt\sqrt\sqrt\sqrt\sqrt\sqrt\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\s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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}'
92
- assert_nothing_raised { output = render.render(text) }
92
+ output = render.render(text)
93
93
  assert_equal output[:data], text
94
94
  assert_equal output[:exception].class, Mathematical::ParseError
95
95
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'nokogiri'
3
3
 
4
- class Mathematical::MathJaxTest < Test::Unit::TestCase
4
+ class Mathematical::MathJaxTest < MiniTest::Test
5
5
 
6
6
  render_svg = Mathematical.new
7
7
 
@@ -12,8 +12,7 @@ class Mathematical::MathJaxTest < Test::Unit::TestCase
12
12
  Dir["#{MATHJAX_TEST_TEX_DIR}/**/*.tex"].each do |tex|
13
13
  define_method "test_#{tex}" do
14
14
  tex_contents = File.read(tex)
15
- data = nil
16
- assert_nothing_raised { data = render_svg.render(tex_contents) }
15
+ data = render_svg.render(tex_contents)
17
16
 
18
17
  # assert the SVG actually rendered
19
18
  doc = Nokogiri::HTML(data[:data])
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::MathMLTest < Test::Unit::TestCase
3
+ class Mathematical::MathMLTest < MiniTest::Test
4
4
 
5
5
  def test_it_returns_mathml
6
6
  string = '''
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::MultiplesTest < Test::Unit::TestCase
3
+ class Mathematical::MultiplesTest < MiniTest::Test
4
4
 
5
5
  def setup
6
6
  @render = Mathematical.new(:base64 => true)
@@ -1,15 +1,13 @@
1
1
  require 'test_helper'
2
2
  require 'benchmark'
3
3
 
4
- class Mathematical::BasicTest < Test::Unit::TestCase
4
+ class Mathematical::BasicTest < MiniTest::Test
5
5
  def test_it_handles_big_files
6
- assert_nothing_raised do
7
- big_file = File.read('test/mathematical/fixtures/performance/big_file.text')
8
- speed = Benchmark.realtime do
9
- MathToItex(big_file).convert { |equation| Mathematical.new.render(equation) }
10
- end
11
-
12
- assert_operator speed, :<=, 5
6
+ big_file = File.read('test/mathematical/fixtures/performance/big_file.text')
7
+ speed = Benchmark.realtime do
8
+ MathToItex(big_file).convert { |equation| Mathematical.new.render(equation) }
13
9
  end
10
+
11
+ assert_operator speed, :<=, 5
14
12
  end
15
13
  end
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class Mathematical::PNGTest < Test::Unit::TestCase
3
+ class Mathematical::PNGTest < MiniTest::Test
4
4
  def before
5
5
  File.delete("#{fixtures_dir}/png/pmatrix.png") if File.exist?("#{fixtures_dir}/png/pmatrix.png")
6
6
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'bundler/setup'
2
2
  require 'mathematical'
3
- require 'test/unit'
4
- require 'mocha/test_unit'
3
+ require 'minitest/autorun'
4
+ require 'minitest/pride'
5
5
  require 'math-to-itex'
6
6
  require 'pp'
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathematical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
55
  - !ruby/object:Gem::Dependency
56
- name: mocha
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '5.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '5.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: math-to-itex
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -418,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
418
418
  version: '0'
419
419
  requirements: []
420
420
  rubyforge_project:
421
- rubygems_version: 2.2.2
421
+ rubygems_version: 2.2.3
422
422
  signing_key:
423
423
  specification_version: 4
424
424
  summary: '["Quickly", "convert", "math", "equations", "into", "beautiful", "SVGs/PNGs/MathML."]'