Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Test expecting 57, 123; code review #10

Open
gaulouis opened this issue Aug 21, 2016 · 0 comments
Open

Unit Test expecting 57, 123; code review #10

gaulouis opened this issue Aug 21, 2016 · 0 comments

Comments

@gaulouis
Copy link

gaulouis commented Aug 21, 2016

Hello,

Inspiring on C ++ test for my unit tests in C, I noticed an error in the expecting result. Maybe the +1 has no effect?

In https://github.com/antlr/antlr4-cpp/blob/master/antlr4cpp/antlr/test/test_interval_set.cpp

        void test_mixed_ranges_and_elements()
        {
            interval_set s;
            s.insert(1);
            s.insert(std::make_pair(L'a',L'z'+1));
            s.insert(std::make_pair(L'0',L'9'+1));
            std::wstring expecting = L"{1, 48..57, 97..122}";
        }

by comparison with Java implementation

        IntervalSet interval_set = new IntervalSet();
        interval_set.add(1);
        interval_set.add('a', 'z'+1);
        interval_set.add('0', '9'+1);
        String str = interval_set.toString();
        String expecting = "{1, 48..58, 97..123}";

PS:
C ++ operator overloading is friendly

    interval_set s;
    s << 1;// s+1 is ambigus
    s << interval('a', 'z'+1);
    s &= interval('0', '9'+1);
    s |= interval('0', '9'+1);

    std::cout << s << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant