ThreatSourceLibaray/docs/project/test_method.md

50 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 测试方法
## 测试框架
MSTest
### 测试命令
1. 测试全部用例
```bash
dotnet test
```
2. 测试指定用例
```bash
dotnet test --filter "FullyQualifiedName=ThreatSource.Tests.Utils.Vector3DPerformanceTests.Baseline_Vector3D_Class_Performance"
```
3. 测试指定用例并输出详细日志
```bash
dotnet test --filter "FullyQualifiedName=ThreatSource.Tests.Utils.Vector3DPerformanceTests.Baseline_Vector3D_Class_Performance" --logger "console;verbosity=detailed" | cat
```
### 测试报告
时间2025-05-16
测试目的:测试 Vector3D 作为类和结构体的性能差异
测试用例ThreatSource.Tests.Utils.Vector3DPerformanceTests.Baseline_Vector3D_Class_Performance
测试结果:
1. 这是更改为 struct 之前的性能(作为类的 Vector3D
Creation: 67 ms
Addition: 29 ms
Subtraction: 19 ms
Scalar Mult: 16 ms
Dot Product: 11 ms
Cross Product: 24 ms
Magnitude: 12 ms
Normalization: 40 ms
2. 这是更改为 struct 之后 的性能:
Creation: 21 ms
Addition: 23 ms
Subtraction: 22 ms
Scalar Mult: 15 ms
Dot Product: 12 ms
Cross Product: 25 ms
Magnitude: 14 ms
Normalization: 51 ms