Skip to content

Commit 0a92c48

Browse files
authored
Merge pull request #57 from bdach/object-count-limits
2 parents 8683a9b + 74c3e22 commit 0a92c48

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

osu.Server.BeatmapSubmission.Tests/ValidationTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,32 @@ public void TestValidationRange()
3232

3333
Assert.False(success);
3434
}
35+
36+
[Fact]
37+
public void TestObjectCounts()
38+
{
39+
var beatmap = new osu_beatmap
40+
{
41+
beatmap_id = 100000,
42+
filename = "100000.osu",
43+
checksum = "deadbeef",
44+
version = "a version",
45+
diff_drain = 5,
46+
diff_size = 5,
47+
diff_overall = 5,
48+
diff_approach = 5,
49+
bpm = 120,
50+
countNormal = ushort.MaxValue + 1,
51+
countSlider = ushort.MaxValue + 1,
52+
countSpinner = ushort.MaxValue + 1,
53+
playmode = 1,
54+
};
55+
56+
var errors = new List<ValidationResult>();
57+
bool success = Validator.TryValidateObject(beatmap, new ValidationContext(beatmap), errors, validateAllProperties: true);
58+
59+
Assert.False(success);
60+
Assert.Equal(3, errors.Count);
61+
}
3562
}
3663
}

osu.Server.BeatmapSubmission/Models/Database/osu_beatmap.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public class osu_beatmap : IValidatableObject
3434
[Range(typeof(uint), "0", "16777215", ErrorMessage = "The beatmap has too many objects.")]
3535
public uint countTotal { get; set; }
3636

37-
[Range(typeof(uint), "0", "16777215", ErrorMessage = "The beatmap has too many objects.")]
37+
[Range(typeof(uint), "0", "65535", ErrorMessage = "The beatmap has too many objects.")]
3838
public uint countNormal { get; set; }
3939

40-
[Range(typeof(uint), "0", "16777215", ErrorMessage = "The beatmap has too many objects.")]
40+
[Range(typeof(uint), "0", "65535", ErrorMessage = "The beatmap has too many objects.")]
4141
public uint countSlider { get; set; }
4242

43-
[Range(typeof(uint), "0", "16777215", ErrorMessage = "The beatmap has too many objects.")]
43+
[Range(typeof(uint), "0", "65535", ErrorMessage = "The beatmap has too many objects.")]
4444
public uint countSpinner { get; set; }
4545

4646
[Range(0.0, 10.0, ErrorMessage = "The drain rate of the beatmap is out of range.")]

0 commit comments

Comments
 (0)