BenchmarkValidateTxn measures transaction reference validation
(b *testing.B)
| 220 | |
| 221 | // BenchmarkValidateTxn measures transaction reference validation |
| 222 | func BenchmarkValidateTxn(b *testing.B) { |
| 223 | setupBenchmarkConfig() |
| 224 | mockDS := setupMockDataSource() |
| 225 | |
| 226 | ledgerforgeInstance := &LedgerForge{ |
| 227 | datasource: mockDS, |
| 228 | config: setupBenchmarkConfig(), |
| 229 | } |
| 230 | |
| 231 | ctx := context.Background() |
| 232 | |
| 233 | b.ResetTimer() |
| 234 | for i := 0; i < b.N; i++ { |
| 235 | txn := createTestTransaction("source-001", "dest-001", fmt.Sprintf("ref-%d", i), 100.00) |
| 236 | err := ledgerforgeInstance.validateTxn(ctx, txn) |
| 237 | if err != nil { |
| 238 | b.Fatal(err) |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | // BenchmarkHashBalanceID measures the hash function used for queue assignment |
| 244 | func BenchmarkHashBalanceID(b *testing.B) { |
nothing calls this directly
no test coverage detected