(t *testing.T)
| 229 | } |
| 230 | |
| 231 | func TestHashContent(t *testing.T) { |
| 232 | content1 := "Hello, World!" |
| 233 | content2 := "Hello, World!" |
| 234 | content3 := "Different content" |
| 235 | |
| 236 | hash1 := hashContent(content1) |
| 237 | hash2 := hashContent(content2) |
| 238 | hash3 := hashContent(content3) |
| 239 | |
| 240 | // 相同内容应该产生相同哈希 |
| 241 | if hash1 != hash2 { |
| 242 | t.Error("Same content should produce same hash") |
| 243 | } |
| 244 | |
| 245 | // 不同内容应该产生不同哈希 |
| 246 | if hash1 == hash3 { |
| 247 | t.Error("Different content should produce different hash") |
| 248 | } |
| 249 | |
| 250 | // 哈希应该是 16 字符 |
| 251 | if len(hash1) != 16 { |
| 252 | t.Errorf("Hash should be 16 chars, got %d", len(hash1)) |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | func TestIsValidFilePath(t *testing.T) { |
| 257 | tests := []struct { |
nothing calls this directly
no test coverage detected