-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Add Comments] components:libc:cplusplus:os/utest:Some comments have been initially … #10870
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
f585842
bfe680c
5de6ed9
e5875df
eb1d86a
41c5aa0
5983ccb
0d6b97c
504ee76
5fd24f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,28 +11,45 @@ | |||||||||
|
|
||||||||||
| using namespace rtthread; | ||||||||||
|
|
||||||||||
| /** | ||||||||||
| * @brief Semaphore class implementation. | ||||||||||
| */ | ||||||||||
| Semaphore::Semaphore(const char *name, int32_t count) | ||||||||||
| { | ||||||||||
| // Initialize the semaphore with a specified count and FIFO order. | ||||||||||
| rt_sem_init(&mID, name, count, RT_IPC_FLAG_FIFO); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /** | ||||||||||
| * @brief Wait on the semaphore. | ||||||||||
| * @param millisec Timeout in milliseconds. | ||||||||||
| * @return Boolean indicating if the semaphore was successfully taken. | ||||||||||
|
||||||||||
| * @param millisec Timeout in milliseconds. | |
| * @return Boolean indicating if the semaphore was successfully taken. | |
| * @param millisec Timeout in milliseconds (-1 for infinite wait). | |
| * @return true if the semaphore was successfully taken, false on timeout. |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Doxygen Tag / 缺少 Doxygen 标签
English: This comment is missing the @brief tag. Add it for consistency with other function documentation.
中文:此注释缺少 @brief 标签。为了与其他函数文档保持一致,请添加它。
Suggested format / 建议格式:
/**
* @brief Release the semaphore.
*/
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Doxygen Tag / 缺少 Doxygen 标签
English: This comment is missing the @brief tag. Add it for consistency with other documentation in the file.
中文:此注释缺少 @brief 标签。为了与文件中其他文档保持一致,请添加它。
Suggested format / 建议格式:
/**
* @brief Destructor that detaches the semaphore when the object is destroyed.
*/| * Detach the semaphore when the object is destroyed. | |
| * @brief Destructor that detaches the semaphore when the object is destroyed. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,11 +11,14 @@ | |||||||||||||||||
|
|
||||||||||||||||||
| using namespace rtthread; | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * @brief Thread class constructor with parameters for stack size, priority, tick, and name. | ||||||||||||||||||
|
||||||||||||||||||
| * @brief Thread class constructor with parameters for stack size, priority, tick, and name. | |
| * @brief Thread class constructor with parameters for stack size, priority, tick, and name. | |
| * @param stack_size Stack size in bytes | |
| * @param priority Thread priority | |
| * @param tick Time slice in ticks | |
| * @param name Thread name |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Formatting Issue / 代码格式问题
English: The brace placement doesn't follow RT-Thread coding style. According to RT-Thread coding standards, braces should be on separate lines, not on the same line as the colon in constructor initializer lists. The original formatting was more aligned with the standard.
中文:大括号位置不符合 RT-Thread 编码风格。根据 RT-Thread 编码标准,大括号应独占一行,而不是与构造函数初始化列表中的冒号在同一行。原始格式更符合标准。
Original format (preferred) / 原格式(推荐):
const char *name)
: _entry(RT_NULL), _param(RT_NULL), started(false)
{Current format (non-standard) / 当前格式(不标准):
const char *name) :
_entry(RT_NULL), _param(RT_NULL), started(false)
{
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The Doxygen comment should document all parameters. Add @param tags for entry, p, stack_size, priority, tick, and name parameters.
中文:Doxygen 注释应记录所有参数。为 entry、p、stack_size、priority、tick 和 name 参数添加 @param 标签。
| * @brief Thread class constructor with entry function and parameters. | |
| * @brief Thread class constructor with entry function and parameters. | |
| * @param entry The entry function pointer for the thread. | |
| * @param p The parameter to pass to the entry function. | |
| * @param stack_size The size of the thread stack in bytes. | |
| * @param priority The priority of the thread. | |
| * @param tick The time slice (tick) for the thread. | |
| * @param name The name of the thread. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Formatting Issue / 代码格式问题
English: The brace placement doesn't follow RT-Thread coding style. According to RT-Thread coding standards, braces should be on separate lines, not on the same line as the colon in constructor initializer lists.
中文:大括号位置不符合 RT-Thread 编码风格。根据 RT-Thread 编码标准,大括号应独占一行,而不是与构造函数初始化列表中的冒号在同一行。
Original format (preferred) / 原格式(推荐):
const char *name)
: _entry(entry), _param(p), started(false)
{| _entry(entry), _param(p), started(false) | |
| _entry(entry), _param(p), started(false) |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The comment should include @return documentation to describe the return value properly.
中文:注释应包含 @return 文档以正确描述返回值。
Suggested / 建议:
/**
* @brief Start the thread execution.
* @return true if the thread was successfully started, false otherwise
*/| * @return Boolean indicating if the thread was successfully started. | |
| * @return true if the thread was successfully started, false otherwise |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Doxygen Tag / 缺少 Doxygen 标签
English: This comment is missing the @brief tag. For consistency with other function documentation in the file, add the @brief tag and document the parameter.
中文:此注释缺少 @brief 标签。为了与文件中其他函数文档保持一致,添加 @brief 标签并记录参数。
Suggested format / 建议格式:
/**
* @brief Make the thread sleep for a specified duration.
* @param millisec Duration in milliseconds
*/| * Make the thread sleep for a specified duration. | |
| * @brief Make the thread sleep for a specified duration. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Doxygen Tag and Parameter Documentation / 缺少 Doxygen 标签和参数文档
English: This comment is missing the @brief tag and parameter documentation. Add proper Doxygen tags for consistency.
中文:此注释缺少 @brief 标签和参数文档。添加适当的 Doxygen 标签以保持一致性。
Suggested format / 建议格式:
/**
* @brief Static function to run the thread's entry function.
* @param pThis Pointer to the Thread instance
*/| * Static function to run the thread's entry function. | |
| * @brief Static function to run the thread's entry function. | |
| * @param pThis Pointer to the Thread instance. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Doxygen Tag and Parameter Documentation / 缺少 Doxygen 标签和参数文档
English: This comment is missing the @brief tag and parameter documentation. Add proper Doxygen tags.
中文:此注释缺少 @brief 标签和参数文档。添加适当的 Doxygen 标签。
Suggested format / 建议格式:
/**
* @brief Default run function that can be overridden by subclasses.
* @param parameter User-defined parameter passed to the thread
*/| * Default run function that can be overridden by subclasses. | |
| * @brief Default run function that can be overridden by subclasses. | |
| * @param parameter User-defined parameter passed to the thread. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The comment is missing the @brief tag and should document both the parameter and return value.
中文:注释缺少 @brief 标签,并且应该记录参数和返回值。
Suggested format / 建议格式:
/**
* @brief Wait for the thread to complete with a timeout.
* @param millisec Timeout in milliseconds
* @return RT_EOK if the thread completed within the timeout, error code otherwise
*/| * Wait for the thread to complete with a timeout. | |
| * @param millisec Timeout in milliseconds. | |
| * @return Status code indicating the execution status. | |
| * @brief Wait for the thread to complete with a timeout. | |
| * @param millisec Timeout in milliseconds. | |
| * @return RT_EOK if the thread completed within the timeout, error code otherwise. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The comment is missing the @brief tag and should document both the parameter and return value.
中文:注释缺少 @brief 标签,并且应该记录参数和返回值。
Suggested format / 建议格式:
/**
* @brief Join the thread with a timeout.
* @param millisec Timeout in milliseconds
* @return RT_EOK if the thread completed within the timeout, error code otherwise
*/| * Join the thread with a timeout. | |
| * @param millisec Timeout in milliseconds. | |
| * @return Status code indicating the execution status. | |
| * @brief Join the thread with a timeout. | |
| * @param millisec Timeout in milliseconds. | |
| * @return RT_EOK if the thread completed within the timeout, error code otherwise. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static void test_atomic_load_store_int32(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constexpr int kRound = 10000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constexpr int kRound = 10000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int32_t> thread_count(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int32_t> count(100); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(count.load(), 100); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -56,7 +56,7 @@ static void test_atomic_load_store_int32(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static void test_atomic_load_store_int64(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constexpr int kRound = 10000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constexpr int kRound = 10000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int64_t> thread_count(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int64_t> count(100); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(count.load(), 100); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -121,9 +121,9 @@ static void test_atomic_basic_int32(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val.exchange(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(val.load(), 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t x = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t y = 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool exchanged = val.compare_exchange_strong(x, y); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t x = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t y = 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool exchanged = val.compare_exchange_strong(x, y); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_false(exchanged); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(val.load(), 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(x, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -168,9 +168,9 @@ static void test_atomic_basic_int64(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val.exchange(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(val.load(), 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int64_t x = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int64_t y = 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool exchanged = val.compare_exchange_strong(x, y); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int64_t x = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int64_t y = 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool exchanged = val.compare_exchange_strong(x, y); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_false(exchanged); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(val.load(), 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(x, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -191,7 +191,7 @@ static void test_atomic_bool(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flag.exchange(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_false(flag.load()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool expected = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool desired = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool desired = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_true(flag.compare_exchange_strong(expected, desired)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_true(flag.load()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -201,7 +201,7 @@ static void test_atomic_bool(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static void test_atomic_pointer(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int a = 1, b = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int a = 1, b = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int *> ptr(&a); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ptr.store(&b); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(*ptr.load(), 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -230,20 +230,21 @@ static void test_memory_order(void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static void test_compare_exchange_weak(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::atomic<int> val(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int expected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int desired = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int expected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int desired = 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while (!val.compare_exchange_weak(expected, desired)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expected = 1; // reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uassert_int_equal(val.load(), 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Test case initialization function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static rt_err_t utest_tc_init(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return RT_EOK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Test case cleanup function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Test case initialization function. | |
| static rt_err_t utest_tc_init(void) | |
| { | |
| return RT_EOK; | |
| } | |
| // Test case cleanup function. | |
| /** | |
| * @brief Test case initialization function. | |
| * @return RT_EOK on success | |
| */ | |
| static rt_err_t utest_tc_init(void) | |
| { | |
| return RT_EOK; | |
| } | |
| /** | |
| * @brief Test case cleanup function. | |
| * @return RT_EOK on success | |
| */ |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment Style Inconsistency / 注释风格不一致
English: This comment uses // style while the file contains Doxygen-style comments elsewhere. For consistency, use the Doxygen format with /** */ and @brief tag.
中文:此注释使用 // 风格,而文件中其他地方包含 Doxygen 风格的注释。为了一致性,请使用带有 /** */ 和 @brief 标签的 Doxygen 格式。
Suggested format / 建议格式:
/**
* @brief Test case initialization function.
* @return RT_EOK on success
*/| // Test case initialization function. | |
| static rt_err_t utest_tc_init(void) | |
| { | |
| return RT_EOK; | |
| } | |
| // Test case cleanup function. | |
| /** | |
| * @brief Test case initialization function. | |
| * @return RT_EOK on success | |
| */ | |
| static rt_err_t utest_tc_init(void) | |
| { | |
| return RT_EOK; | |
| } | |
| /** | |
| * @brief Test case cleanup function. | |
| * @return RT_EOK on success | |
| */ |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,10 +35,16 @@ static void test_shared_ptr(void) | |||||||
| uassert_int_equal(p1.use_count(), 2); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * @brief Test case initialization function. | ||||||||
|
||||||||
| * @brief Test case initialization function. | |
| * @brief Test case initialization function. | |
| * @return RT_EOK on success |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The Doxygen comment should document the return value. Add @return RT_EOK on success for completeness.
中文:Doxygen 注释应记录返回值。添加 @return RT_EOK on success 以保持完整性。
| */ | |
| * @return RT_EOK on success | |
| */ |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,48 +12,70 @@ | |||||||||
| #include "utest.h" | ||||||||||
| #include <thread> | ||||||||||
|
|
||||||||||
|
|
||||||||||
| /** | ||||||||||
| * @brief Function to test thread functionality. | ||||||||||
| */ | ||||||||||
| static void test_thread(void) | ||||||||||
| { | ||||||||||
| int count = 0; | ||||||||||
| auto func = [&]() mutable | ||||||||||
| { | ||||||||||
| int count = 0; // Initialize a counter to zero. | ||||||||||
|
||||||||||
| int count = 0; // Initialize a counter to zero. | |
| int count = 0; |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Redundant Comment / 冗余注释
English: The comment "Lambda function to increment the count" is too obvious. It's clear from the code that this is a lambda function. A better comment would explain the purpose in the test context, such as "// Lambda to simulate concurrent count increments in thread test."
中文:注释"Lambda function to increment the count"过于明显。从代码可以清楚地看出这是一个 lambda 函数。更好的注释应该在测试上下文中解释目的,例如"// Lambda to simulate concurrent count increments in thread test."
| // Lambda function to increment the count. | |
| // Lambda to simulate concurrent count increments in thread test. |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Redundant Comment / 冗余注释
English: The comment "Increment the count 100 times" is redundant since the for loop already clearly shows i < 100. This is an example of commenting "what" instead of "why." Remove this comment as it adds no value.
中文:注释"Increment the count 100 times"是冗余的,因为 for 循环已经清楚地显示了 i < 100。这是注释"是什么"而不是"为什么"的例子。删除此注释,因为它没有增加任何价值。
| ++count; // Increment the count 100 times. | |
| ++count; |
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Redundant Inline Comments / 冗余的行内注释
English: The inline comments on lines 33, 38, 43, and 48 simply restate what the code does (join, assert, join, assert). These are obvious from reading the code. According to RT-Thread documentation standards, avoid comments that merely describe what the code does when it's self-evident. Better to have a single comment explaining the test logic if needed.
中文:第 33、38、43 和 48 行的行内注释仅重述了代码的功能(join、assert、join、assert)。从代码阅读中这些是显而易见的。根据 RT-Thread 文档标准,避免仅描述代码功能的注释,当代码本身是不言自明的时候。如果需要,最好使用单个注释来解释测试逻辑。
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The Doxygen comment uses @brief but doesn't document the return value. For consistency with RT-Thread documentation standards, add @return RT_EOK on success to make the documentation complete.
中文:Doxygen 注释使用了 @brief,但没有记录返回值。为了与 RT-Thread 文档标准保持一致,添加 @return RT_EOK on success 以使文档完整。
Suggested format / 建议格式:
/**
* @brief Test case initialization function.
* @return RT_EOK on success
*/| * @brief Test case initialization function. | |
| * @brief Test case initialization function. | |
| * @return RT_EOK on success |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The Doxygen comment should document the return value. Add @return RT_EOK on success for consistency and completeness.
中文:Doxygen 注释应记录返回值。添加 @return RT_EOK on success 以保持一致性和完整性。
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码注释的风格统一下,需要使用/**/
Outdated
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment Style Inconsistency / 注释风格不一致
English: This comment uses // style while other function documentation in the file uses /** */ Doxygen style. For consistency across the file, use the Doxygen format with @brief tag like the other functions.
中文:此注释使用 // 风格,而文件中的其他函数文档使用 /** */ Doxygen 风格。为了整个文件的一致性,请使用带有 @brief 标签的 Doxygen 格式,就像其他函数一样。
Suggested format / 建议格式:
/**
* @brief Export the test case with initialization and cleanup functions and a timeout of 10 ticks.
*/| // Export the test case with initialization and cleanup functions and a timeout of 10 ticks. | |
| /** | |
| * @brief Export the test case with initialization and cleanup functions and a timeout of 10 ticks. | |
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Incomplete Doxygen Comment / 不完整的 Doxygen 注释
English: The Doxygen comment should document the constructor parameters. Add
@paramtags for name and count parameters.中文:Doxygen 注释应记录构造函数参数。为 name 和 count 参数添加
@param标签。Suggested format / 建议格式: