mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add tests
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets;
|
||||
@ -43,10 +45,25 @@ namespace osu.Game.Tests.Beatmaps
|
||||
private static Beatmap createTestBeatmap()
|
||||
{
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
|
||||
using (var reader = new LineBufferedReader(stream))
|
||||
return Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
||||
{
|
||||
using (var reader = new LineBufferedReader(stream))
|
||||
{
|
||||
var b = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
||||
|
||||
b.BeatmapInfo.MD5Hash = test_beatmap_hash.Value.md5;
|
||||
b.BeatmapInfo.Hash = test_beatmap_hash.Value.sha2;
|
||||
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Lazy<(string md5, string sha2)> test_beatmap_hash = new Lazy<(string md5, string sha2)>(() =>
|
||||
{
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
|
||||
return (stream.ComputeMD5Hash(), stream.ComputeSHA2Hash());
|
||||
});
|
||||
|
||||
private const string test_beatmap_data = @"osu file format v14
|
||||
|
||||
[General]
|
||||
|
Reference in New Issue
Block a user