-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #337 from andy840119/re-write-generator-test-case
Re write generator test case
- Loading branch information
Showing
8 changed files
with
196 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Asserts | ||
{ | ||
public class TimeTagAssert : Assert | ||
{ | ||
public static void AreEqual(IReadOnlyList<TimeTag> expect, IReadOnlyList<TimeTag> actually) | ||
{ | ||
AreEqual(expect?.Count, actually?.Count); | ||
if (expect == null || actually == null) | ||
return; | ||
|
||
for (int i = 0; i < expect.Count; i++) | ||
{ | ||
AreEqual(expect[i].Index, actually[i].Index); | ||
AreEqual(expect[i].Time, actually[i].Time); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using osu.Framework.Graphics.Sprites; | ||
|
@@ -26,7 +27,7 @@ public static RubyTag ParseRubyTag(string str) | |
var regex = new Regex("(?<start>[-0-9]+),(?<end>[-0-9]+)]:(?<ruby>.*$)"); | ||
var result = regex.Match(str); | ||
if (!result.Success) | ||
return new RubyTag(); | ||
throw new ArgumentException(nameof(str)); | ||
|
||
var startIndex = int.Parse(result.Groups["start"]?.Value); | ||
var endIndex = int.Parse(result.Groups["end"]?.Value); | ||
|
@@ -56,7 +57,7 @@ public static RomajiTag ParseRomajiTag(string str) | |
var regex = new Regex("(?<start>[-0-9]+),(?<end>[-0-9]+)]:(?<romaji>.*$)"); | ||
var result = regex.Match(str); | ||
if (!result.Success) | ||
return new RomajiTag(); | ||
throw new ArgumentException(nameof(str)); | ||
|
||
var startIndex = int.Parse(result.Groups["start"]?.Value); | ||
var endIndex = int.Parse(result.Groups["end"]?.Value); | ||
|
@@ -86,7 +87,7 @@ public static TimeTag ParseTimeTag(string str) | |
var regex = new Regex("(?<index>[-0-9]+),(?<state>start|end)]:(?<time>[-0-9]+|s*|)"); | ||
var result = regex.Match(str); | ||
if (!result.Success) | ||
return new TimeTag(new TimeTagIndex()); | ||
throw new ArgumentException(nameof(str)); | ||
|
||
var index = int.Parse(result.Groups["index"]?.Value); | ||
var state = result.Groups["state"]?.Value == "start" ? TimeTagIndex.IndexState.Start : TimeTagIndex.IndexState.End; | ||
|
Oops, something went wrong.