changed normalized form of games ids
opl seems to work mostly with this format
This commit is contained in:
@@ -53,9 +53,9 @@ func normalizeGameID(id string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prefix := strings.ToUpper(matches[1])
|
prefix := strings.ToUpper(matches[1])
|
||||||
number := matches[2] + matches[3]
|
number := matches[2] + "." + matches[3]
|
||||||
|
|
||||||
return prefix + "-" + number
|
return prefix + "_" + number
|
||||||
}
|
}
|
||||||
|
|
||||||
func renameGameFile(filePath, gameName string) (string, error) {
|
func renameGameFile(filePath, gameName string) (string, error) {
|
||||||
|
|||||||
@@ -12,37 +12,37 @@ func TestParseCases(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "SLUS with underscore and dot",
|
name: "SLUS with underscore and dot",
|
||||||
content: []byte("Some binary data\x00\x00SLUS_123.45\x00\x00more data"),
|
content: []byte("Some binary data\x00\x00SLUS_123.45\x00\x00more data"),
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SLUS with hyphen",
|
name: "SLUS with hyphen",
|
||||||
content: []byte("\x00\x00\x00SLUS-12345\x00\x00\x00"),
|
content: []byte("\x00\x00\x00SLUS-12345\x00\x00\x00"),
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SLES format",
|
name: "SLES format",
|
||||||
content: []byte("Header data\x00SLES_987.65\x00footer"),
|
content: []byte("Header data\x00SLES_987.65\x00footer"),
|
||||||
expected: "SLES-98765",
|
expected: "SLES_987.65",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SLPS format",
|
name: "SLPS format",
|
||||||
content: []byte("\xFF\xFESLPS_456.78\x00"),
|
content: []byte("\xFF\xFESLPS_456.78\x00"),
|
||||||
expected: "SLPS-45678",
|
expected: "SLPS_456.78",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SCUS format",
|
name: "SCUS format",
|
||||||
content: []byte("SCUS-97512"),
|
content: []byte("SCUS-97512"),
|
||||||
expected: "SCUS-97512",
|
expected: "SCUS_975.12",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "No separator format",
|
name: "No separator format",
|
||||||
content: []byte("\x00\x00SLUS12345\x00\x00"),
|
content: []byte("\x00\x00SLUS12345\x00\x00"),
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "With spaces",
|
name: "With spaces",
|
||||||
content: []byte("SLUS 123.45"),
|
content: []byte("SLUS 123.45"),
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "No game ID found",
|
name: "No game ID found",
|
||||||
@@ -82,31 +82,31 @@ func TestNormalize(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
input: "SLUS-12345",
|
input: "SLUS-12345",
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "SLES_987.65",
|
input: "SLES_987.65",
|
||||||
expected: "SLES-98765",
|
expected: "SLES_987.65",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "SLPS_456.78",
|
input: "SLPS_456.78",
|
||||||
expected: "SLPS-45678",
|
expected: "SLPS_456.78",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "scus-97512",
|
input: "scus-97512",
|
||||||
expected: "SCUS-97512",
|
expected: "SCUS_975.12",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "SLUS12345",
|
input: "SLUS12345",
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "SLUS123.45",
|
input: "SLUS123.45",
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: "SLUs123.45",
|
input: "SLUs123.45",
|
||||||
expected: "SLUS-12345",
|
expected: "SLUS_123.45",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user