@ParameterizedTest(name = "{index}: {0}")
  @MethodSource({
    "stackEmpty",
    "stackEmptyAtExit",
    "stackImmediateBytes",
    "stackUnderflow",
    "stackRJumpForward",
    "stackRJumpBackward",
    "stackRJumpI",
    "stackCallF",
    "stackRetF",
    "stackUnreachable",
    "stackHeight",
    "invalidInstructions",
  })
  void validateStackAnalysis(
      final String ignoredName,
      final String expectedError,
      final int sectionToTest,
      final List<List<Object>> rawCodeSections) {

    StringBuilder codeLengths = new StringBuilder();
    StringBuilder typesData = new StringBuilder();
    StringBuilder codeData = new StringBuilder();

    for (var rawCodeSection : rawCodeSections) {
      var code = Bytes.fromHexString(((String) rawCodeSection.get(0)).replace(" ", ""));
      int inputs = (Integer) rawCodeSection.get(1);
      int outputs = (Integer) rawCodeSection.get(2);
      int length = (Integer) rawCodeSection.get(3);

      codeLengths.append(String.format("%04x", code.size()));
      typesData.append(String.format("%02x%02x%04x", inputs, outputs, length));
      codeData.append(code.toUnprefixedHexString());
    }
    int sectionCount = rawCodeSections.size();
    String sb =
        "0xef0001"
            + String.format("01%04x", sectionCount * 4)
            + String.format("02%04x", sectionCount)
            + codeLengths
            + "040000"
            + "00"
            + typesData
            + codeData;

    EOFLayout eofLayout = EOFLayout.parseEOF(Bytes.fromHexString(sb));
    CodeV1Validation validator = new CodeV1Validation(0xc000);

    String validation =
        validator.validateStack(sectionToTest, eofLayout, new WorkList(sectionCount));
    if (expectedError != null) {
      assertThat(validation).contains(expectedError);
    } else {
      assertThat(validation).isNull();
    }
  }
These tests focus on code-only validations, which are checked within the code runs themselves.
Tests that depend on the EOF container (such as CallF into other sections) are in EOFLayoutTest.
evm/src/test/java/org/hyperledger/besu/evm/code/CodeV1Test.java