Files
coding-practice/problems/0165-compare-version-numbers/test/edge_cases.md

30 lines
1.0 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.

# 邊界情況清單165 Compare Version Numbers
## 需要測試的邊界
- [x] 空輸入 / 單一元素:`""``"0"`
- [x] 重複元素 / 全相同:`"1.0.0"` vs `"1"`
- [x] 極值(最小/最大):`"2147483647"` vs `"2147483646"`
- [x] 含負數 / 0 / 大數:題目無負數,已覆蓋多零與大修訂號
- [x] 大資料量接近上限200 段版本字串
## 額外案例
### 案例 1
- 輸入:`version1 = "", version2 = "0"`
- 預期:`0`
- 說明:空字串缺少所有段,視為全 0
### 案例 2
- 輸入:`version1 = "2147483647", version2 = "2147483646"`
- 預期:`1`
- 說明:驗證最大 32-bit 整數段處理
### 案例 3
- 輸入:`version1 = "0.0.0", version2 = "0"`
- 預期:`0`
- 說明:多段全 0 與單段 0 視為相同
### 案例 4
- 輸入:`version1 = string.Join(".", Enumerable.Repeat("0", 199)) + ".1"`, `version2 = string.Join(".", Enumerable.Repeat("0", 200))`
- 預期:`1`
- 說明:長度 200 的版本字串,在最後一段差異才分勝負