• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
              • Atj-input-processing
              • Atj-java-pretty-printer
              • Atj-code-generation
                • Atj-gen-test-method
                • Atj-shallow-code-generation
                • Atj-common-code-generation
                • Atj-shallow-quoted-constant-generation
                • Atj-pre-translation
                • Atj-gen-everything
                • Atj-name-translation
                • Atj-gen-test-cunit
                • Atj-gen-test-class
                  • Atj-gen-main-file
                  • Atj-post-translation
                  • Atj-deep-code-generation
                  • Atj-gen-test-methods
                  • Atj-gen-test-file
                  • Atj-gen-env-file
                  • Atj-gen-output-subdir
                • Atj-java-primitives
                • Atj-java-primitive-arrays
                • Atj-type-macros
                • Atj-java-syntax-operations
                • Atj-fn
                • Atj-library-extensions
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • Riscv
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Atj-code-generation

    Atj-gen-test-class

    Generate the test Java class declaration.

    Signature
    (atj-gen-test-class tests$ deep$ guards$ 
                        no-aij-types$ java-class$ verbose$ 
                        pkg-class-names fn-method-names wrld) 
     
      → 
    class
    Arguments
    tests$ — Guard (atj-test-listp tests$).
    deep$ — Guard (booleanp deep$).
    guards$ — Guard (booleanp guards$).
    no-aij-types$ — Guard (booleanp no-aij-types$).
    java-class$ — Guard (stringp java-class$).
    verbose$ — Guard (booleanp verbose$).
    pkg-class-names — Guard (string-string-alistp pkg-class-names).
    fn-method-names — Guard (symbol-string-alistp fn-method-names).
    wrld — Guard (plist-worldp wrld).
    Returns
    class — Type (jclassp class).

    This is generated only if the :tests input is not nil.

    This is a public class that contains all the generated methods. [JLS14:7.6] says that a Java implementation may require public classes to be in files with the same names (plus extension). The code that we generate satisfies this requirement.

    Definitions and Theorems

    Function: atj-gen-test-class

    (defun atj-gen-test-class
           (tests$ deep$ guards$
                   no-aij-types$ java-class$ verbose$
                   pkg-class-names fn-method-names wrld)
     (declare (xargs :guard (and (atj-test-listp tests$)
                                 (booleanp deep$)
                                 (booleanp guards$)
                                 (booleanp no-aij-types$)
                                 (stringp java-class$)
                                 (booleanp verbose$)
                                 (string-string-alistp pkg-class-names)
                                 (symbol-string-alistp fn-method-names)
                                 (plist-worldp wrld))))
     (let ((__function__ 'atj-gen-test-class))
      (declare (ignorable __function__))
      (b*
       (((run-when verbose$)
         (cw "~%Generate the Java methods to run the tests:~%"))
        (test-methods
            (atj-gen-test-methods tests$ deep$ guards$
                                  no-aij-types$ java-class$ verbose$
                                  pkg-class-names fn-method-names wrld))
        ((run-when verbose$)
         (cw "~%Generate the test Java class.~%"))
        (failures-field (atj-gen-test-failures-field))
        (main-method
            (atj-gen-test-main-method tests$ java-class$ no-aij-types$))
        (body-class
         (append
          (list (jcbody-element-member (jcmember-field failures-field)))
          (jmethods-to-jcbody-elements test-methods)
          (list
               (jcbody-element-member (jcmember-method main-method))))))
       (make-jclass :access (jaccess-public)
                    :abstract? nil
                    :static? nil
                    :final? nil
                    :strictfp? nil
                    :name (str::cat java-class$ "Tests")
                    :superclass? nil
                    :superinterfaces nil
                    :body body-class))))

    Theorem: jclassp-of-atj-gen-test-class

    (defthm jclassp-of-atj-gen-test-class
      (b*
       ((class
             (atj-gen-test-class tests$ deep$ guards$
                                 no-aij-types$ java-class$ verbose$
                                 pkg-class-names fn-method-names wrld)))
       (jclassp class))
      :rule-classes :rewrite)