testsp0 := procedure(n,q)
  printf "Conjugacy test in Sp(%o,%o)\n", n, q;
  G := SymplecticGroup(n,q);
  dd := Classes(G);
  L := G`Labels_S;
  delete G;
  G := SymplecticGroup(n,q);
  cc := Classes(G : Al := "Random");
  assert L eq { InternalConjugacyInvariantSp(c[3]) : c in cc };
  print "Passed\n";
end procedure;

testsp0(4,3);
testsp0(4,5);

testcsp1:= procedure(n,q)
  printf "Conjugacy class sizes in CSp(%o,%o)\n", n, q;
  G := ConformalSymplecticGroup(n,q);
  dd := Classes(G);
  L := G`Labels_S;
  delete G;
  G := ConformalSymplecticGroup(n,q);
  cc := Classes(G : Al := "Random");
  assert L eq { InternalConjugacyInvariantCSp(c[3]) : c in cc };
  print "Passed\n";
end procedure;

testcsp1(4,3);
testcsp1(4,5);

testsp1 := procedure(n,q)
  printf "Number of class invariants for Sp(%o,%o)\n", n,q;
  f := IsometryGroupNumberOfClasses("symplecticOdd",n);
  assert #InternalClassInvariantsSp(n,q) eq Evaluate(f,q);
  print "Passed\n";
end procedure;

testsp1(6,5);
testsp1(6,9);

testsp2 := procedure(n,r)
  printf "Conjugacy invariants and representatives for Sp(%o,%o)\n", n,r;
  for mu in InternalClassInvariantsSp(n,r) do
    g := InternalRepMatrixSp(mu);
    c := InternalConjugacyInvariantSp(g);
    assert mu eq c;
  end for;
  print "Passed\n";
end procedure;

testsp2(4,3);
testsp2(8,5);

testcsp2 := procedure(n,r)
  printf "Conjugacy invariants for CSp(%o,%o)\n", n,r;
  for mu in InternalClassInvariantsCSp(n,r) do
    g := InternalRepMatrixCSp(mu);
    c := InternalConjugacyInvariantCSp(g);
    assert mu eq c;
  end for;
  print "Passed\n";
end procedure;

testcsp2(4,5);

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

testsp3(4,3);
testsp3(6,3);

testsp4 := procedure(n,r)
  printf "Number of conjugacy classes for Sp(%o,%o)\n", n,r;
  cc := Classes(Sp(n,r));
  assert #cc eq Evaluate(IsometryGroupNumberOfClasses("symplecticOdd",n),r);
  print "Passed\n";
end procedure;

testsp4(6,3);

testcsp5 := procedure(n,q)
  printf "Conjugacy coverage test for CSp(%o,%o)\n", n, q;
  C := CSp(n,q);
  cc := Classes(C);
  X := [ c[3] : c in cc ];
  if exists(i,j){ <i,j> : i in [1..j-1], j in [2..#cc] |
    IsConjugate(C,X[i],X[j]) } then
    print "Error at", i,j;
  else
    print "Distinct conjugates";
  end if;
  assert #C eq &+[ c[2] : c in cc ];
  print "Passed\n";
end procedure;

testcsp5(4,3);

testcsp6 := procedure(n,q,m)
  printf "Conjugacy classes for ExtendedSp(%o,%o,%o)\n", n,q,m;
  G := ExtendedSp(n,q,m);
  time cc := Classes(G : Al := "Lifting");
  reps := { c[3] : c in cc };
  delete G;
  G := ExtendedSp(n,q,m);
  cr := { c[3] : c in Classes(G)};
  assert forall{ g : g in reps | exists{ h : h in cr | IsConjugate(G,g,h) } };
  assert forall{ h : h in cr | exists{ g : g in reps | IsConjugate(G,g,h) } };
  print "Passed\n";
end procedure;

testcsp6(4,7,2);
testcsp6(4,7,3);


testcsp7 := procedure(n,q,m)
  printf "Class sizes in ExtendedSp(%o,%o,%o)\n", n,q,m;
  G := ExtendedSp(n,q,m);
  time cc := Classes(G);
  assert #G eq &+[ c[2] : c in cc ];
  print "Passed\n";
end procedure;

testcsp7(4,7,2);
testcsp7(4,7,3);
testcsp7(6,7,2);
testcsp7(6,7,3);
testcsp7(4,13,4);
testcsp7(4,13,6);

