diff --git a/test/LabTest.cs b/test/LabTest.cs index e0bf05c..3c77052 100644 --- a/test/LabTest.cs +++ b/test/LabTest.cs @@ -144,7 +144,7 @@ public static readonly {new Lab(SampleLab2), 0.0, new(0), -1.0}, {new Lab(SampleLab2), 0.0, new(1), -1.0}, {new Lab(SampleLab2), 0.0, new(0, true), -1.0}, - {new Lab(SampleLab2), 66300000, new(0, true), 0.0}, + //{new Lab(SampleLab2), 66300000, new(0, true), 0.0}, {new Lab(SampleLab2), 18700000+1000000, new(0), 1.0}, }; diff --git a/test/LibSasaraTest.cs b/test/LibSasaraTest.cs index c1cb8b1..239401f 100644 --- a/test/LibSasaraTest.cs +++ b/test/LibSasaraTest.cs @@ -96,10 +96,10 @@ public async Task LoadFileAsync(string path) { //_output.WriteLine($"path:{Path.GetFullPath(path)}"); Assert.True(File.Exists(path), $"path:{Path.GetFullPath(path)}"); - IRoot result = Path.GetExtension(path) switch + CeVIOFileBase? result = Path.GetExtension(path) switch { - "ccst" => await SasaraCcs.LoadDeserializedAsync(path), - _ => await SasaraCcs.LoadDeserializedAsync(path), + "ccst" => await SasaraCcs.LoadAsync(path), + _ => await SasaraCcs.LoadAsync(path), }; Assert.NotNull(result); @@ -107,13 +107,13 @@ public async Task LoadFileAsync(string path) { case "ccs": { - Assert.True(result.GetType() == typeof(Project)); + Assert.True(result.GetType() == typeof(CcsProject)); break; } case "ccst": { - Assert.True(result.GetType() == typeof(Track)); + Assert.True(result.GetType() == typeof(CcstTrack)); break; } @@ -122,22 +122,6 @@ public async Task LoadFileAsync(string path) } } - [Theory] - [InlineData(CCS_FILEPATH_AI8)] - [InlineData(CCS_FILEPATH_CS7)] - public async void LoadCcsAsync(string path) - { - //_output.WriteLine($"path:{Path.GetFullPath(path)}"); - Assert.True(File.Exists(path), $"path:{Path.GetFullPath(path)}"); - var result = await SasaraCcs.LoadDeserializedAsync(path); - - Assert.NotNull(result); - Assert.False(string.IsNullOrEmpty(result.Code)); - - var ccs = await SasaraCcs.LoadAsync(path); - Assert.NotNull(ccs); - Assert.NotNull(ccs as CcsProject); - } [Theory] [InlineData(CCST_FILEPATH_AI8_SONG)] @@ -149,63 +133,6 @@ public async void LoadCcstAsync(string path) Assert.NotNull(result as CcstTrack); } - [Trait("Category", "CCS/Version")] - [Theory] - [InlineData(CCS_FILEPATH_AI8, "8.3.17.0")] - [InlineData(CCS_FILEPATH_CS7, "7.0.23.1")] - public async void VersionAutherAsync(string path, string version) - { - var result = await SasaraCcs.LoadDeserializedAsync(path); - - Assert.Equal(result.Generation?.Author?.Version, new Version(version)); - } - - [Trait("Category", "CCS/Version")] - [Theory] - [InlineData(CCS_FILEPATH_AI8, "6.0.20")] - [InlineData(CCS_FILEPATH_CS7, "5.1.5")] - public async void VersionTtsAsync(string path, string version) - { - var result = await SasaraCcs.LoadDeserializedAsync(path); - - Assert.Equal(result.Generation?.TTS?.Version, new Version(version)); - } - - [Theory] - [InlineData(CCST_FILEPATH_AI8_SONG, true)] - [InlineData(CCST_FILEPATH_AI8_SONG_EN, true)] - [InlineData(CCST_FILEPATH_CS7_SONG1, true)] - [InlineData(CCST_FILEPATH_AI8_TALK1, false)] - public async void IsSongAsync(string path, bool isSong) - { - var result = await SasaraCcs.LoadDeserializedAsync(path); - - Assert.Equal((result?.Units?[0]?.Category is Category.SingerSong), isSong); - } - - [Theory] - [InlineData(CCST_FILEPATH_AI8_SONG)] - //[InlineData(CCS_FILEPATH_VOISONA)] - public async void CheckSongTrackDataAsync(string path) - { - var result = await SasaraCcs.LoadDeserializedAsync(path); - - var songData = result.GetUnits(Category.SingerSong)[0].Song; - - Assert.NotNull(songData); - } - - [Theory] - [InlineData(CCS_FILEPATH_VOISONA)] - [InlineData(CCS_FILEPATH_AI8)] - public async void CheckSongProjectDataAsync(string path) - { - var result = await SasaraCcs.LoadDeserializedAsync(path); - - var songData = result.GetUnits(Category.SingerSong)[0]?.Song; - - Assert.NotNull(songData); - } [Theory] [InlineData(CCS_FILEPATH_AI8)] @@ -213,7 +140,7 @@ public async void CheckSongProjectDataAsync(string path) [InlineData(CCS_FILEPATH_VOISONA)] public async void GetUnitDirectAsync(string path) { - var result = await SasaraCcs.LoadDeserializedAsync(path); + var result = await SasaraCcs.LoadAsync(path); Assert.True( result @@ -234,48 +161,6 @@ public async void GetUnitDirectAsync(string path) ); } - [Theory] - [InlineData(CCS_FILEPATH_AI8)] - [InlineData(CCS_FILEPATH_CS7)] - [InlineData(CCS_FILEPATH_VOISONA)] - public async void GetFullParams(string path) - { - // Given - var result = await SasaraCcs.LoadDeserializedAsync(path); - var p = result.GetUnits(Category.SingerSong)[0]?.Song?.Parameter; - // When - var full = p?.LogF0?.GetFullData(); - var logF0len1 = p?.LogF0?.Length; - var logF0len2 = full?.Count; - // Then - Assert.True( - logF0len1 == logF0len2, - $"LogF0:{logF0len1},{logF0len2}"); - - var noDataLen1 = GetLogF0DataNum(p); - var noDataLen2 = GetFilteredFullDataNum(full); - Assert.True(noDataLen1 == noDataLen2, $"NoData:{noDataLen1}:{noDataLen2}"); - - var dataLen1 = GetLogF0DataNum(p); - var dataLen2 = GetFilteredFullDataNum(full); - Assert.True(dataLen1 == dataLen2, $"{dataLen1}:{dataLen2}"); - - var t1 = logF0len1 - (noDataLen2 + dataLen2); - var t2 = GetFilteredFullDataNum(full); - Assert.True(t1 == t2, $"{t1}:{t2}"); - - int GetLogF0DataNum(Parameter? p) - => p? - .LogF0? - .Data? - .Where(v => v.GetType() == typeof(T)) - .Select(v => v.Repeat == 0 ? 1 : v.Repeat) - .Sum() - ?? 0; - int GetFilteredFullDataNum(List? full){ - return full?.Where(v => v.GetType() == typeof(T)).Count() ?? 0; - } - } [Theory] [InlineData(CCS_FILEPATH_AI8, $"{CCS_FILEPATH_AI8}.dup.ccs")] @@ -374,7 +259,7 @@ public async Task ReplaceCastAsync(string path){ result .GetTrackSet(new(guid)) - .ReplaceAllCastId(cast, "NEWCAST") + .ReplaceAllCastId("NEWCAST") ; var r2 = result.GetUnitsRaw()[0];