@Test
public void testStructDonation() throws Exception {

  final ShaderJobFileOperations fileOps = new ShaderJobFileOperations();
  final String usesStruct = "struct A { int x; }; void main() { { A a = A(1); a.x = 2; } }";
  final File donorsFolder = temporaryFolder.newFolder();
  for (int i = 0; i < 10; i++) {
    final File donor = new File(
        Paths.get(donorsFolder.getAbsolutePath(), "donor" + i + ".frag").toString());
    fileOps.writeStringToFile(donor, usesStruct);
  }
  final String reference = "void main() { ; { ; ; ; }; ; { ; ; ; }; ; ; ; ; ; ; }";
  final TranslationUnit tu = ParseHelper.parse(reference);
  new DonateLiveCodeTransformation(TransformationProbabilities
      .likelyDonateLiveCode()::donateLiveCodeAtStmt,
      donorsFolder, GenerationParams.normal(ShaderKind.FRAGMENT, true), false)
      .apply(tu,
          TransformationProbabilities.likelyDonateLiveCode(),
          new RandomWrapper(0),
          GenerationParams.normal(ShaderKind.FRAGMENT, true));
}