-
Notifications
You must be signed in to change notification settings - Fork 1
/
SemiDirectProdUnitTest.cs
60 lines (52 loc) · 1.88 KB
/
SemiDirectProdUnitTest.cs
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
56
57
58
59
60
using System;
using System.Linq;
using FastGoat;
using FastGoat.Gp;
using FastGoat.UserGroup;
using Xunit;
namespace Tests;
public class SemiDirectProdUnitTest
{
[Fact]
public void Test1ThrowException()
{
var z3 = new Zn(3);
var g3 = Group.Generate(z3[1]);
Assert.Throws<GroupException>(() => Group.SemiDirectProd(g3, g3));
}
[Fact]
public void Test2SemiDirectProduct()
{
var g2 = Group.Generate(new Zn(2)[1]);
var g3 = Group.Generate(new Zn(3)[1]);
var g4 = Group.Generate(new Zn(4)[1]);
var d3 = Group.SemiDirectProd(g3, g2);
var d4 = Group.SemiDirectProd("D4", g4, g2);
var s3 = new Sn(3);
var g6 = Group.Generate(s3[(1, 2)], s3[(1, 2, 3)]);
Assert.True(d3.IsIsomorphicTo(g6));
Assert.Equal("D4", d4.Name);
}
[Fact]
public void Test3ComplexSemiDirectProduct()
{
var g1 = Group.SemiDirectProd(Product.Generate(new Cn(3), new Cn(3)), new Cn(2));
Assert.Equal(GroupType.NonAbelianGroup, g1.GroupType);
Assert.Equal(18, g1.Count());
Assert.True(Group.IsGroup(g1));
var g2 = Group.SemiDirectProd(new Cn(8), Product.Generate(new Cn(2), new Cn(2)));
Assert.Equal(GroupType.NonAbelianGroup, g2.GroupType);
Assert.Equal(32, g2.Count());
Assert.True(Group.IsGroup(g2));
var g3 = Group.SemiDirectProd(Product.Generate(new Cn(2), new Cn(2), new Cn(2)),
Product.Generate(new Cn(2), new Cn(2)));
Assert.Equal(GroupType.NonAbelianGroup, g3.GroupType);
Assert.Equal(32, g3.Count());
Assert.True(Group.IsGroup(g3));
var g4 = Group.SemiDirectProd(new Cn(3), new Cn(8));
var g5 = Group.SemiDirectProd(g4, new Cn(2));
Assert.Equal(GroupType.NonAbelianGroup, g5.GroupType);
Assert.Equal(48, g5.Count());
Assert.True(Group.IsGroup(g5));
}
}