Skip to content

Commit

Permalink
Updated to NET9
Browse files Browse the repository at this point in the history
- updated to NET9 / C# 13
- compatible with PKHeX 24.11.11
- updated workflows
- more clean up
  • Loading branch information
Bl4ckSh4rk committed Nov 13, 2024
1 parent 81be811 commit ea3bd36
Show file tree
Hide file tree
Showing 42 changed files with 677 additions and 629 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 1
allow:
- dependency-name: "PKHeX.Core"
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@ name: Build
on:
push:
branches: [ master ]
paths-ignore:
- '.github/**'
- '*.md'

jobs:
build:

runs-on: windows-latest

env:
PROJECT_NAME: WC3Plugin
DOTNET_VERSION: 9.0.x
OUT_DIR: build

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore Dependencies
run: dotnet restore
- name: Build Release
run: dotnet build WC3Plugin --no-restore --configuration Release -o build
run: dotnet build ${{ env.PROJECT_NAME }} --no-restore --configuration Release -o ${{ env.OUT_DIR }}
- name: Run Tests
run: dotnet test
run: dotnet test --no-restore --verbosity normal
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: WC3Plugin
path: build/*.dll
if-no-files-found: error
name: ${{ env.PROJECT_NAME }}
path: ${{ env.OUT_DIR }}/*.dll
if-no-files-found: error
33 changes: 33 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PR Test

on:
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '.github/**'
- '*.md'

jobs:
build-and-test:
runs-on: windows-latest

env:
PROJECT_NAME: WC3Plugin
DOTNET_VERSION: 9.0.x
OUT_DIR: build

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore Dependencies
run: dotnet restore
- name: Build Release
run: dotnet build ${{ env.PROJECT_NAME }} --no-restore --configuration Release -o ${{ env.OUT_DIR }}
- name: Run Tests
run: dotnet test --no-restore --verbosity normal
289 changes: 144 additions & 145 deletions Test/ECBTest.cs
Original file line number Diff line number Diff line change
@@ -1,152 +1,151 @@
using NUnit.Framework;
using Xunit;
using PKHeX.Core;
using WC3Plugin;

namespace Test
namespace Test;

public class ECBTest
{
public class ECBTest
[Fact]
public void ImportEmeraldEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}
[Fact]
public void ImportEmeraldJapanese()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}

[Fact]
public void ImportRSEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}
[Fact]
public void ImportRSJapanese()
{
[Test]
public void ImportEmeraldEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}
[Test]
public void ImportEmeraldJapanese()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}

[Test]
public void ImportRSEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}
[Test]
public void ImportRSJapanese()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}

[Test]
public void ImportFRLGEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.FRLG_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}
[Test]
public void ImportFRLGJapanese()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.FRLG_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(clean);
sav.ImportECB(ecb);

Assert.That(sav.HasECB(), Is.True);
Assert.That(sav.Write(), Is.EqualTo(expected));
}


[Test]
public void ExportEmeraldEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
[Test]
public void ExportEmeraldJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
[Test]
public void ExportRSEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
[Test]
public void ExportRSJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
[Test]
public void ExportFRLGEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
[Test]
public void ExportFRLGJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(sav_ecb);

Assert.That(ecb, Is.EqualTo(sav.ExportECB()));
}
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}

[Fact]
public void ImportFRLGEnglish()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.FRLG_EN}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}
[Fact]
public void ImportFRLGJapanese()
{
byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.FRLG_JP}");
byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(clean);
sav.ImportECB(ecb);

Assert.True(sav.HasECB());
Assert.Equal(sav.Write(), expected);
}


[Fact]
public void ExportEmeraldEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
[Fact]
public void ExportEmeraldJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3E sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
[Fact]
public void ExportRSEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
[Fact]
public void ExportRSJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_RS_EN}");

SAV3RS sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
[Fact]
public void ExportFRLGEnglish()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_EN_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
[Fact]
public void ExportFRLGJapanese()
{
byte[] sav_ecb = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.FRLG_JP_ECB}");
byte[] ecb = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Berry_EM_EN}");

SAV3FRLG sav = new(sav_ecb);

Assert.Equal(ecb, sav.ExportECB());
}
}
Loading

0 comments on commit ea3bd36

Please sign in to comment.