Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Unit Test expecting 57, 123; code review

未关闭
#10 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp
领域
testing

调研方向

从 antlr4cpp/antlr/test/test_interval_set.cpp 和 test_mixed_ranges_and_elements() 方法开始。将其预期的区间字符串与所示的 Java 实现进行比较,并运行相关的 C++ 单元测试。当测试期望或区间行为得到确认,并与预期的包含端点范围语义保持一致时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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;
主要语言
C++
星标
80
派生
33
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

antlr/antlr4-cpp 的其他 Issue

查看 antlr/antlr4-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。