Rewrote the comments in the libraries under 'includes' in English (excluding those inside folders)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# testcheck - 回归测试格式化输出库
|
||||
# 提供 PASS/FAIL 计数、分节标题、汇总报告
|
||||
# testcheck - Regression test formatted output library
|
||||
# Provide PASS/FAIL counts, section headers, summary reports
|
||||
import t, c
|
||||
import stdio
|
||||
from w32.win32console import SetConsoleOutputCP, SetConsoleCP
|
||||
@@ -13,7 +13,7 @@ _total_fail: t.CInt = 0
|
||||
|
||||
|
||||
def begin(name: str):
|
||||
"""开始测试套件,打印头部并重置当前套件计数器(累计计数不变)"""
|
||||
"""Start the test suite, print the header, and reset the current suite counter (total count remains the same)"""
|
||||
global _pass_count, _fail_count
|
||||
_pass_count = 0
|
||||
_fail_count = 0
|
||||
@@ -23,26 +23,26 @@ def begin(name: str):
|
||||
|
||||
|
||||
def section(name: str):
|
||||
"""打印分节标题"""
|
||||
"""Print the section header"""
|
||||
stdio.printf("--- %s ---\n", name)
|
||||
|
||||
|
||||
def ok(msg: str):
|
||||
"""打印 PASS 并计数"""
|
||||
"""Print PASS and count"""
|
||||
global _pass_count
|
||||
_pass_count += 1
|
||||
stdio.printf("PASS: %s\n", msg)
|
||||
|
||||
|
||||
def fail(msg: str):
|
||||
"""打印 FAIL 并计数"""
|
||||
"""Print FAIL and count"""
|
||||
global _fail_count
|
||||
_fail_count += 1
|
||||
stdio.printf("FAIL: %s\n", msg)
|
||||
|
||||
|
||||
def check(cond: t.CInt, ok_msg: str, fail_msg: str):
|
||||
"""条件检查,自动选择 PASS/FAIL"""
|
||||
"""Conditional check, automatically select PASS/FAIL"""
|
||||
if cond:
|
||||
ok(ok_msg)
|
||||
else:
|
||||
@@ -50,12 +50,12 @@ def check(cond: t.CInt, ok_msg: str, fail_msg: str):
|
||||
|
||||
|
||||
def info(msg: str):
|
||||
"""打印信息消息(不计入 PASS/FAIL)"""
|
||||
"""Print information message (not counted in the PASS/FAIL messages)"""
|
||||
stdio.printf("%s\n", msg)
|
||||
|
||||
|
||||
def end() -> t.CInt:
|
||||
"""打印当前套件汇总,累加到总计,返回当前套件失败数"""
|
||||
"""Print the current suite summary, accumulate to total, return the current suite fail count"""
|
||||
global _total_pass, _total_fail
|
||||
_total_pass += _pass_count
|
||||
_total_fail += _fail_count
|
||||
@@ -65,7 +65,7 @@ def end() -> t.CInt:
|
||||
|
||||
|
||||
def summary() -> t.CInt:
|
||||
"""打印所有套件的总计汇总,返回总失败数"""
|
||||
"""Print the total summary of all suites, return the total fail count"""
|
||||
stdio.printf("\n=== Total Summary ===\n")
|
||||
stdio.printf("Total PASS: %d, Total FAIL: %d\n", _total_pass, _total_fail)
|
||||
return _total_fail
|
||||
|
||||
Reference in New Issue
Block a user