From 76dc8145bf7ac0bb10db3e9e8de4a20ac95eef50 Mon Sep 17 00:00:00 2001 From: Lucas Nakano Perez Date: Sun, 15 Feb 2026 20:00:09 -0300 Subject: [PATCH] test --- README.md | 1 + race_condition_test.go | 14 ++++++-------- test/additional_edge_cases.go | 11 ++++++++--- test/edge_case_fixtures.go | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3a34ce7..95db0a1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Rule Engine 🚀 + [![Go Version](https://img.shields.io/badge/Go-1.24+-blue.svg)](https://golang.org) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Tests](https://img.shields.io/badge/Tests-All%20Passing-brightgreen.svg)](#) diff --git a/race_condition_test.go b/race_condition_test.go index 07b5546..d4116e6 100644 --- a/race_condition_test.go +++ b/race_condition_test.go @@ -182,7 +182,10 @@ func TestEngine_RaceCondition_DifferentQueries(t *testing.T) { if errorCount > 0 { t.Errorf("❌ RACE CONDITION DETECTED: %d evaluations returned incorrect results", errorCount) } else { - t.Logf("✅ No race conditions detected in %d concurrent mixed query evaluations", numGoroutines*iterationsPerGoroutine) + t.Logf( + "✅ No race conditions detected in %d concurrent mixed query evaluations", + numGoroutines*iterationsPerGoroutine, + ) } require.Equal(t, 0, errorCount, "All evaluations should return correct results") @@ -252,19 +255,14 @@ func TestEngine_RaceCondition_SameQueryDifferentContexts(t *testing.T) { errorCount++ } - require.Positive( - t, - errorCount, - "❌ RACE CONDITION DETECTED: %d evaluations returned incorrect results", - errorCount, + require.Equal(t, 0, errorCount, + "❌ RACE CONDITION DETECTED: %d evaluations returned incorrect results", errorCount, ) t.Logf( "✅ No race conditions detected in %d concurrent evaluations with different contexts", numGoroutines*iterationsPerGoroutine, ) - - require.Equal(t, 0, errorCount, "All evaluations should return correct results") } // Helper functions diff --git a/test/additional_edge_cases.go b/test/additional_edge_cases.go index 213b12c..a7689d8 100644 --- a/test/additional_edge_cases.go +++ b/test/additional_edge_cases.go @@ -40,9 +40,14 @@ var AdditionalEdgeCaseTests = []Case{ }, true}, // Performance edge cases - {"very_long_string", `text co "needle"`, rule.D{ - "text": "This is a very long string that contains the word needle somewhere in the middle of all this text that goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on", - }, true}, + { + "very_long_string", + `text co "needle"`, + rule.D{ + "text": "This is a very long string that contains the word needle somewhere in the middle of all this text that goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on", + }, + true, + }, // Empty string edge cases {"empty_string_contains_empty", `x co ""`, rule.D{"x": "hello"}, true}, diff --git a/test/edge_case_fixtures.go b/test/edge_case_fixtures.go index 5bcc810..3dfeda0 100644 --- a/test/edge_case_fixtures.go +++ b/test/edge_case_fixtures.go @@ -224,6 +224,7 @@ var ExtremeValueTests = []Case{ for i := range 1000 { arr[i] = i } + return arr }(), }, true},