@Test
public void createRandomStruct() {

  CannedRandom generator = new CannedRandom(
      2 /* (2 + 1) fields */,
      true /* first field is struct */,
      1 /* with (1 + 1) fields */,
      false /* first of which is not a struct */,
      0 /* instead it is FLOAT */,
      false /* second of which is not a struct */,
      1 /* instead it is VEC2 */,
      false /* second top-level field is not a struct */,
      0 /* instead it is FLOAT */,
      true /* third top-level field is a struct */,
      0 /* with (0 + 1) field */,
      false /* that is not a struct */,
      0 /* instead it is FLOAT */);
  List<StructDefinitionType> structs = StructificationMutation.randomStruct(0, generator,
      new IdGenerator(), ShadingLanguageVersion.GLSL_440,
      GenerationParams.normal(ShaderKind.FRAGMENT, true));
  assertEquals(3, structs.size());
  StructDefinitionType enclosingStruct = structs.get(0);
  assertEquals(enclosingStruct.getFieldName(0), "_f0");
  assertEquals(enclosingStruct.getFieldName(1), "_f1");
  assertEquals(enclosingStruct.getFieldName(2), "_f2");
  assertTrue(enclosingStruct.getFieldType(0) instanceof StructNameType);
  assertEquals(enclosingStruct.getFieldType(0), structs.get(1).getStructNameType());
  assertEquals(enclosingStruct.getFieldName(1), "_f1");
  assertTrue(enclosingStruct.getFieldType(2) instanceof StructNameType);
  assertEquals(enclosingStruct.getFieldType(2), structs.get(2).getStructNameType());
  assertEquals(enclosingStruct.getFieldType(1), BasicType.FLOAT);
  assertEquals(lookupDeclaration((StructNameType) enclosingStruct.getFieldType(0), structs)
      .getFieldType(0), BasicType.FLOAT);
  assertEquals(lookupDeclaration((StructNameType) enclosingStruct.getFieldType(0), structs)
      .getFieldType(1), BasicType.VEC2);
  assertEquals(lookupDeclaration((StructNameType) enclosingStruct.getFieldType(2), structs)
          .getFieldType(0),
      BasicType.FLOAT);
  assertTrue(generator.isExhausted());
}