File: diff_test.rb

package info (click to toggle)
docdiff 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: ruby: 13,872; makefile: 92; lisp: 33; sh: 26
file content (37 lines) | stat: -rwxr-xr-x 1,039 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/ruby
require 'test/unit'
require "docdiff/diff"

class TC_DocDiff_Diff < Test::Unit::TestCase
  Diff = DocDiff::Diff

  def setup()
    #
  end

  def test_new_ses()
    a1 = [:a, :b, :c]
    a2 = [:a, :x, :c]
    expected = [[:common_elt_elt, [:a], [:a]],
                [:del_elt,        [:b], nil],
                [:add_elt,         nil, [:x]],
                [:common_elt_elt, [:c], [:c]]]
    actual              = []
    actual_speculative  = []
    actual_shortestpath = []
    actual_contours     = []
    Diff.new(a1, a2).ses               .each{|e| actual              << e}
    Diff.new(a1, a2).ses(:speculative ).each{|e| actual_speculative  << e}
    Diff.new(a1, a2).ses(:shortestpath).each{|e| actual_shortestpath << e}
    Diff.new(a1, a2).ses(:contours    ).each{|e| actual_contours     << e}
    assert_equal(expected, actual)
    assert_equal(expected, actual_speculative)
    assert_equal(expected, actual_shortestpath)
    assert_equal(expected, actual_contours)
  end

  def teardown()
    #
  end

end