| 246 | } |
| 247 | if ExitAuthFailure != 10 { |
| 248 | t.Errorf("ExitAuthFailure should be 10, got %d", ExitAuthFailure) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | func TestBackendKeyGeneration(t *testing.T) { |
| 253 | // Generate multiple keys and verify they're different (high probability) |
| 254 | keys := make(map[int32]bool) |
| 255 | for i := 0; i < 100; i++ { |
| 256 | key := generateSecretKey() |
| 257 | if key == 0 { |
| 258 | t.Error("Generated secret key should not be 0") |
| 259 | } |
| 260 | keys[key] = true |
| 261 | } |
| 262 | |
| 263 | // With good randomness, we should have close to 100 unique keys |
| 264 | if len(keys) < 90 { |
| 265 | t.Errorf("Expected mostly unique keys, got only %d unique out of 100", len(keys)) |
| 266 | } |