Reporting of Test

オープン
#3,080 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@mr3screen がすでに取り組んでいます。

2026年3月17日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
cpp
領域
testing-qa

調査の方向性

示されているTEST、uint8_t値、CHECK_THAT、WithinAbs matcherを使って問題を再現し、その後、展開された値に対するCatch2のreporting pathを追跡します。数値出力のリグレッションカバレッジを追加し、ctestの失敗レポートで結果を検証します。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
I catched a bug in my code by some test, but the error message was a little misleading:

FAILED:
[ctest]   CHECK_THAT( some_uint8_t, WithinAbs(5.5, 0.5) )
[ctest] with expansion:
[ctest]   '2' is within 0.5 of 5.5

I wondered, where the 2 could have possibly come from, until I ran the test in the VSCode debugger, which automatically prints next to each uint8_t variable its numeric value and it's ascii character.

'2' is a character, but we're doing a number comparison, so printing a character is only misleading.

Expected behavior

FAILED:
[ctest]   CHECK_THAT( some_uint8_t, WithinAbs(5.5, 0.5) )
[ctest] with expansion:
[ctest]   50 is within 0.5 of 5.5

Reproduction steps
Something like

#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
TEST("misleading error message", "") {
    uint8_t var = 50;
    CHECK_THAT( var, WithinAbs(5.5, 0.5) );
}

Platform information:

  • OS: ubuntu 24.04
  • Compiler+version: gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
  • Catch version: Catch2 v3.4.0
主要言語
C++
スター
21.6k
フォーク
3.4k
平均マージ
3日 12時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

catchorg/Catch2 のほかの issue

catchorg/Catch2 の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。