Goose  Diff

Differences From Artifact [331de8c08d]:

  • File bs/empathy.cpp — part of check-in [adc06c3670] at 2018-11-03 00:19:40 on branch trunk — ir: Implemented Compare. (user: achavasse size: 1161)

To Artifact [475d333162]:

  • File bs/empathy.cpp — part of check-in [907ee61bc1] at 2018-11-04 16:20:01 on branch trunk — ir: added tests for trie/term merging and fixed multiple issues with the trie data model and the Merge implementation. (user: achavasse size: 1204)

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
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










-










+
+
+



-
+







#include "ir/ir.h"

using namespace std;
using namespace empathy;
using namespace empathy::util;

int main( int argc, char** argv )
{
    // Just a dumping place for simple test code for now.
    auto gg = TVEC( TSID( foo ), TSTR( "bar" ), VECOFLENGTH( N ), REPEAT( ANYTERM( U ) ) );
   // ir::ToString( cout, gg ) << endl;

    ir::Trie<> testTrie;
    testTrie = Merge( testTrie, gg );
    testTrie = Merge( testTrie, TVEC( TSID( blah ), TSTR( "bar" ) ) );
    testTrie = Merge( testTrie, TVEC( TSID( foo ), TSTR( "bar" ) ) );
    testTrie = Merge( testTrie, TVEC( TSID( blah ), TSTR( "meh" ) ) );
    auto testTrie2 = testTrie;
    testTrie = Merge( testTrie, TSTR( "bar" ) );
    testTrie = Merge( testTrie, TSTR( "foo" ) );
    testTrie = Merge( testTrie, TVEC( TSID( foo ), TSTR( "barrr" ), VECOFLENGTH( M ), REPEAT( ANYTERM( U ) ) ) );
    testTrie = Merge( testTrie, TVEC() );
    testTrie = Merge( testTrie, TVEC( TSID( gg ) ) );

    ir::GraphVizDump( "dump2.dot", testTrie );

    for( auto&& t : Enumerate( testTrie ) )
        ir::ToString( cout, t ) << endl;
        cout << t << endl;

    cout << Compare( testTrie, testTrie2 ) << endl;
    cout << Compare( testTrie2, testTrie2 ) << endl;
    cout << Compare( testTrie, testTrie ) << endl;

    return EXIT_SUCCESS;
}