package regression import ( "modify/processor" "os" "testing" ) func TestTalentsMechanicOutOfRange(t *testing.T) { given := ` ` actual := ` ` p := &processor.RegexProcessor{} result, mods, matches, err := p.ProcessContent(given, `!anyvalue="(?!num)"!anyvalue="(?!num)"!anyvalue="(?!num)"!anyamount="(?!num)"`, "movementspeed=round(movementspeed*1.5, 2) duration=round(duration*2, 2) repairspeed=round(repairspeed*2, 2) durationv=duration") if err != nil { t.Fatalf("Error processing content: %v", err) } if matches != 1 { t.Errorf("Expected 1 match, got %d", matches) } if mods != 1 { t.Errorf("Expected 1 modification, got %d", mods) } if result != actual { t.Errorf("expected %s, got %s", actual, result) } } func TestIndexExplosions(t *testing.T) { given, err := os.ReadFile("testfiles/OutpostItems.xml") if err != nil { t.Fatalf("Error reading file: %v", err) } expected, err := os.ReadFile("testfiles/OutpostItemsExpected.xml") if err != nil { t.Fatalf("Error reading file: %v", err) } p := &processor.RegexProcessor{} actual, mods, matches, err := p.ProcessContent(string(given), `LightComponent!anyrange="(!num)"`, "*4") if err != nil { t.Fatalf("Error processing content: %v", err) } if matches != 1 { t.Errorf("Expected 1 match, got %d", matches) } if mods != 1 { t.Errorf("Expected 1 modification, got %d", mods) } if string(actual) != string(expected) { t.Errorf("expected %s, got %s", expected, actual) } }