summaryrefslogtreecommitdiff
path: root/Impostor-dev/src/Impostor.Tests/GameCodeTests.cs
blob: de981235159475eaea8e62b79daada87cb9c53bb (plain)
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
using Impostor.Api.Innersloth;

using Xunit;

namespace Impostor.Tests
{
    public class GameCodeTests
    {
        [Fact]
        public void CodeV1()
        {
            const string code = "ABCD";
            const int codeInt = 0x44434241;

            Assert.Equal(code, GameCodeParser.IntToGameName(codeInt));
            Assert.Equal(codeInt, GameCodeParser.GameNameToInt(code));
        }

        [Fact]
        public void CodeV2()
        {
            const string code = "ABCDEF";
            const int codeInt = -1943683525;

            Assert.Equal(code, GameCodeParser.IntToGameName(codeInt));
            Assert.Equal(codeInt, GameCodeParser.GameNameToInt(code));
        }
    }
}