Skip to content

Conversation

Rbb666
Copy link
Member

@Rbb666 Rbb666 commented Sep 19, 2025

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds advanced C++11 test cases to the RT-Thread unit testing framework, expanding the coverage of C++11 features beyond the existing thread test case.

  • Adds comprehensive test cases for C++11 features including atomic operations, smart pointers, mutexes, lambda expressions, and auto keyword
  • Updates the SConscript build configuration to automatically include all C++ test cases with a more flexible dependency system
  • Provides thorough testing of concurrent programming features with proper synchronization and memory ordering

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tc_smartptr.cpp Tests unique_ptr and shared_ptr basic operations and reference counting
tc_mutex.cpp Tests mutex operations including lock_guard, recursive_mutex, try_lock, and multi-mutex locking
tc_lambda.cpp Tests basic lambda expressions and capture mechanisms
tc_auto.cpp Tests auto keyword type deduction and range-based for loops
tc_atomic.cpp Comprehensive atomic operations testing including multi-threaded scenarios and memory ordering
SConscript Updates build configuration to use glob pattern for automatic test case inclusion

Comment on lines 21 to 29
if (*p != 42)
{
uassert_false(true);
}
*p = 24;
if (*p != 24)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Using uassert_false(true) to indicate test failure is confusing and incorrect. Use uassert_true(false) or better yet, uassert_int_equal(*p, 42) for clearer test intent.\n中文:使用 uassert_false(true) 来表示测试失败是令人困惑且不正确的。应使用 uassert_true(false) 或更好的方法是使用 uassert_int_equal(*p, 42) 来更清楚地表达测试意图。

Suggested change
if (*p != 42)
{
uassert_false(true);
}
*p = 24;
if (*p != 24)
{
uassert_false(true);
}
uassert_int_equal(*p, 42);
*p = 24;
uassert_int_equal(*p, 24);

Copilot uses AI. Check for mistakes.

Comment on lines 26 to 29
if (*p != 24)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Same issue as above - use uassert_int_equal(*p, 24) for clearer assertion.\n中文:与上述相同的问题 - 使用 uassert_int_equal(*p, 24) 来进行更清晰的断言。

Suggested change
if (*p != 24)
{
uassert_false(true);
}
uassert_int_equal(*p, 24);

Copilot uses AI. Check for mistakes.

Comment on lines 40 to 43
if (*p1 != 42 || *p2 != 42)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use separate uassert_int_equal calls for p1 and p2 to make test failures more specific and easier to debug.\n中文:为 p1 和 p2 使用单独的 uassert_int_equal 调用,使测试失败更具体且更容易调试。

Suggested change
if (*p1 != 42 || *p2 != 42)
{
uassert_false(true);
}
if (*p1 != 42)
{
uassert_false(true);
}
if (*p2 != 42)
{
uassert_false(true);
}

Copilot uses AI. Check for mistakes.

Comment on lines 44 to 47
if (p1.use_count() != 2)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use uassert_int_equal(p1.use_count(), 2) for better error reporting.\n中文:使用 uassert_int_equal(p1.use_count(), 2) 以获得更好的错误报告。

Suggested change
if (p1.use_count() != 2)
{
uassert_false(true);
}
uassert_int_equal(p1.use_count(), 2);

Copilot uses AI. Check for mistakes.

Comment on lines 38 to 41
if (count != 2000)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use uassert_int_equal(count, 2000) for clearer assertion and better error reporting.\n中文:使用 uassert_int_equal(count, 2000) 来进行更清晰的断言和更好的错误报告。

Copilot uses AI. Check for mistakes.

Comment on lines +67 to +66
if (count != 2000)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use uassert_int_equal(count, 2000) for clearer assertion and better error reporting.\n中文:使用 uassert_int_equal(count, 2000) 来进行更清晰的断言和更好的错误报告。

Suggested change
if (count != 2000)
{
uassert_false(true);
}
uassert_int_equal(count, 2000);

Copilot uses AI. Check for mistakes.

Comment on lines +20 to +23
if (lambda() != 42)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use uassert_int_equal(lambda(), 42) for clearer assertion and better error reporting.\n中文:使用 uassert_int_equal(lambda(), 42) 来进行更清晰的断言和更好的错误报告。

Suggested change
if (lambda() != 42)
{
uassert_false(true);
}
uassert_int_equal(lambda(), 42);

Copilot uses AI. Check for mistakes.

Comment on lines +34 to +37
if (lambda() != 20)
{
uassert_false(true);
}
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English: Use uassert_int_equal(lambda(), 20) for clearer assertion and better error reporting.\n中文:使用 uassert_int_equal(lambda(), 20) 来进行更清晰的断言和更好的错误报告。

Suggested change
if (lambda() != 20)
{
uassert_false(true);
}
uassert_int_equal(lambda(), 20);

Copilot uses AI. Check for mistakes.

@Rbb666 Rbb666 marked this pull request as draft September 22, 2025 03:06
@Rbb666 Rbb666 marked this pull request as ready for review September 22, 2025 14:33
@Rbb666 Rbb666 merged commit db1779e into RT-Thread:master Sep 23, 2025
38 checks passed
@Rbb666 Rbb666 added this to the v5.2.2 milestone Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants