test0gu := procedure(n,q)
  printf "Compare with Classes(G : Al := \"Lifting\") in GU(%o,%o)\n", n, q;
  G := GU(n,q);
  time reps := Classes(G);
  L := G`Labels_S;
  delete G;
  G := GU(n,q);
  time cc := Classes(G : Al := "Lifting");
  assert #Set(reps) eq #cc;
  assert L eq { InternalConjugacyInvariantGU(c[3]) : c in cc };
  print "Passed\n";
end procedure;

test0gu(3,2);
test0gu(3,3);
test0gu(3,4);
test0gu(3,5);
test0gu(4,3);

test1gu := procedure(n,r)
  printf "Class sizes for GU(%o,%o)\n", n,r;
  f := IsometryGroupNumberOfClasses("unitary",n);
  assert #InternalClassInvariantsGU(n,r) eq Evaluate(f,r);
  print "Passed\n";
end procedure;

test1gu(5,4);
test1gu(6,4);
test1gu(5,5);
test1gu(6,5);

test2gu := procedure(n,r)
  printf "Conjugacy invariants for GU(%o,%o)\n", n,r;
  for mu in InternalClassInvariantsGU(n,r) do
    g := InternalRepMatrixGU(mu);
    c := InternalConjugacyInvariantGU(g);
    assert mu eq c;
  end for;
  print "Passed\n";
end procedure;

test2gu(4,3);
test2gu(5,4);
test2gu(5,5);
test2gu(6,5);

test3gu := procedure(n,r)
  printf "Centraliser orders for GU(%o,%o)\n", n,r;
  S := GU(n,r);
  cc := Classes(S);
  L := S`Labels_S;
  for i -> mu in L do
    g := InternalRepMatrixGU(mu);
    assert g eq cc[i][3];
    assert Index(S,Centraliser(S,g)) eq cc[i][2];
  end for;
  print "Passed\n";
end procedure;

test3gu(4,3);
test3gu(4,4);
test3gu(5,3);

test4gu := procedure(n,r)
  printf "Randomised conjugacy invariants for GU(%o,%o)\n", n,r;
  G := GU(n,r);
  for mu in InternalClassInvariantsGU(n,r) do
    g := InternalRepMatrixGU(mu);
    h := Random(G);
    c := InternalConjugacyInvariantGU(g^h);
    assert mu eq c;
  end for;
  print "Passed\n";
end procedure;

test4gu(4,5);
test4gu(5,5);
test4gu(6,4);


test0su := procedure(n,q)
  printf "Compare with Classes(SU(%o,%o) : Al := \"Lifting\")\n", n,q;
  G := SU(n,q);
  time reps := Classes(G);
  L := G`Labels_S;
  delete G;
  G := SU(n,q);
  time cc := Classes(G : Al := "Lifting");
  assert #Set(reps) eq #cc;
  assert { mu[1] : mu in L } eq { InternalConjugacyInvariantGU(c[3]) : c in cc };
  D := [1..#cc];
  for X in reps do
    assert exists(i){ i : i in D | IsConjugate(G,X[3],cc[i][3]) };
    Exclude(~D,i);
  end for;
  print "Passed\n";
end procedure;

test0su(2,5);
test0su(2,7);
test0su(3,2);
test0su(3,3);
test0su(3,4);
test0su(4,3);

test1su := procedure(n,r)
  printf "Class sizes for SU(%o,%o)\n", n,r;
  f := #Classes(SU(n,r) : Al := "Lifting");
  assert #InternalClassInvariantsExtSU(n,r,1) eq f;
  print "Passed\n";
end procedure;

test1su(3,3);
test1su(4,3);
test1su(3,4);
test1su(4,4);

test2su := procedure(n,r,m)
  printf "Conjugacy invariants for ExtSU(%o,%o,%o)\n", n,r,m;
  for inv in InternalClassInvariantsExtSU(n,r,m) do
    g := InternalRepMatrixExtSU(inv);
    c := InternalConjugacyInvariantGU(g);
    assert inv[1] eq c;
  end for;
  print "Passed\n";
end procedure;

test2su(3,2,1);
test2su(3,3,1);
test2su(3,3,2);
test2su(3,4,1);
test2su(3,8,3);
test2su(4,2,1);
test2su(4,3,1);
test2su(4,3,2);
test2su(4,4,1);
test2su(4,4,5);


