-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathTileGenerateTests.cs
More file actions
55 lines (44 loc) · 1.54 KB
/
TileGenerateTests.cs
File metadata and controls
55 lines (44 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using BenchmarkDotNet.Attributes;
using ModFramework;
using NUnit.Framework;
using Terraria;
using Terraria.Utilities;
using TerrariaServerAPI.Tests.Benchmarks;
namespace TerrariaServerAPI.Tests;
/// <summary>
/// Tests that generation works and no regressions have occurred (heaptile for example)
/// No benchmarks are in place as it's unreasonable to bench like this, since world generation
/// is random.
/// </summary>
public class TileGenerateTests : TileBenchmarks
{
/// <summary>
/// Invokes creating a new world, while preparing terrarias variables used during generation.
/// </summary>
/// <param name="provider">The provider to use for generating</param>
/// <remarks>Note, there are too many random calls in here for this to be suitable for a benchmark, only regressing testing.</remarks>
public void Generate_Small(ICollection<ITile> provider)
{
Main.tile = provider;
WorldGen.generatingWorld = true;
Main.ActiveWorldFileData.SetSeed("seeeeeeeeeed");
Main.rand = new UnifiedRandom(Main.ActiveWorldFileData.Seed);
Main.menuMode = 888;
WorldGen.clearWorld();
WorldGen.GenerateWorld();
}
[Test]
public void Generate_Small_Stock() => Generate_Small(_stock);
[Test]
public void Generate_Small_Heap() => Generate_Small(_heap);
[Test]
public void Generate_Small_Constileation() => Generate_Small(_const);
#if TILED_PLUGIN
[Test]
public void Generate_Small_1d() => Generate_Small(_1d);
[Test]
public void Generate_Small_2d() => Generate_Small(_2d);
[Test]
public void Generate_Small_Struct() => Generate_Small(_struct);
#endif
}