#lang racket

(require rackunit
         (submod seashell/seashell-config typed)
         (for-syntax racket/syntax))

(define-syntax (test-case-type stx)
  (syntax-case stx ()
    [(test-case-type type name)
     #`(test-case #,(format "Configuration test for: ~a with type: ~a"
                            (syntax->datum #'name)
                            (syntax->datum #'type))
        (#,(format-id #'type #:source #'type
                      "read-config-~a" (syntax-e #'type))
         'name))]))

(define/provide-test-suite config-suite
  (test-suite "Typed Racket Configuration Tests"
    (test-case-type path seashell-support)
    (test-case-type path seashell-clang)
    (test-case-type path seashell-known-hosts)
    (test-case-type string seashell-known-hosts)
    (test-case-type path seashell-racket-runtime-library)
    (test-case-type path seashell-install)
    (test-case-type path ssl-key)
    (test-case-type string ssl-key)
    (test-case-type path ssl-cert)
    (test-case-type string ssl-cert)
    (test-case-type path tunnel-binary)
    (test-case-type string tunnel-binary)
    (test-case-type path seashell-backend-remote)
    (test-case-type string seashell-backend-remote)
    (test-case-type path llvm-symbolizer)
    (test-case-type string llvm-symbolizer)
    (test-case-type path system-linker)
    (test-case-type string system-linker)
    (test-case-type strings compiler-flags)
    (test-case-type integer header-search-depth)
    (test-case-type integer program-run-timeout)
    (test-case-type optional-path login-tracking-helper)
    (test-case-type boolean debug)
    (test-case-type strings host)
    (test-case-type path seashell)
    (test-case-type string seashell)
    (test-case-type path runtime-files-path)
    (test-case-type string runtime-files-path)
    (test-case-type string seashell-creds-name)
    (test-case-type string seashell-creds-cook)
    (test-case-type string tests-subdirectory)
    (test-case-type string common-subdirectory)
    (test-case-type string submit-tool)
    (test-case-type path submit-tool)
    (test-case-type string default-project-template)
    (test-case-type integer seashell-ping-timeout)
    (test-case-type integer backend-client-idle-timeout)
    (test-case-type integer backend-client-connection-timeout)
    (test-case-type integer io-buffer-size)
    (test-case-type integer server-memory-limit)
    (test-case-type integer request-memory-limit)
    (test-case-type integer backend-login-timeout)
    (test-case-type string system-shell)
    (test-case-type path system-shell)
    (test-case-type string racket-interpreter)
    (test-case-type path racket-interpreter)
    (test-case-type path diff-program)
    (test-case-type string diff-program)
    (test-case-type path ssh-binary)
    (test-case-type string ssh-binary)
    (test-case-type string linker-flag-prefix)
    (test-case-type optional-path seashell-login-logfile)
    (test-case-type nonnegative-real compiler-ttl)))

#lang racket

(require rackunit
         (submod seashell/seashell-config typed)
         (for-syntax racket/syntax))

(define-syntax (test-case-type stx)
  (syntax-case stx ()
    [(test-case-type type name)
     #`(test-case #,(format "Configuration test for: ~a with type: ~a"
                            (syntax->datum #'name)
                            (syntax->datum #'type))
        (#,(format-id #'type #:source #'type
                      "read-config-~a" (syntax-e #'type))
         'name))]))

(define/provide-test-suite config-suite
  (test-suite "Typed Racket Configuration Tests"
    (test-case-type path seashell-support)
    (test-case-type path seashell-clang)
    (test-case-type path seashell-known-hosts)
    (test-case-type string seashell-known-hosts)
    (test-case-type path seashell-racket-runtime-library)
    (test-case-type path seashell-install)
    (test-case-type path ssl-key)
    (test-case-type string ssl-key)
    (test-case-type path ssl-cert)
    (test-case-type string ssl-cert)
    (test-case-type path tunnel-binary)
    (test-case-type string tunnel-binary)
    (test-case-type path seashell-backend-remote)
    (test-case-type string seashell-backend-remote)
    (test-case-type path llvm-symbolizer)
    (test-case-type string llvm-symbolizer)
    (test-case-type path system-linker)
    (test-case-type string system-linker)
    (test-case-type strings compiler-flags)
    (test-case-type integer header-search-depth)
    (test-case-type integer program-run-timeout)
    (test-case-type optional-path login-tracking-helper)
    (test-case-type boolean debug)
    (test-case-type strings host)
    (test-case-type path seashell)
    (test-case-type string seashell)
    (test-case-type path runtime-files-path)
    (test-case-type string runtime-files-path)
    (test-case-type string seashell-creds-name)
    (test-case-type string seashell-creds-cook)
    (test-case-type string tests-subdirectory)
    (test-case-type string common-subdirectory)
    (test-case-type string submit-tool)
    (test-case-type path submit-tool)
    (test-case-type string default-project-template)
    (test-case-type integer seashell-ping-timeout)
    (test-case-type integer backend-client-idle-timeout)
    (test-case-type integer backend-client-connection-timeout)
    (test-case-type integer io-buffer-size)
    (test-case-type integer server-memory-limit)
    (test-case-type integer request-memory-limit)
    (test-case-type integer backend-login-timeout)
    (test-case-type string system-shell)
    (test-case-type path system-shell)
    (test-case-type string racket-interpreter)
    (test-case-type path racket-interpreter)
    (test-case-type path diff-program)
    (test-case-type string diff-program)
    (test-case-type path ssh-binary)
    (test-case-type string ssh-binary)
    (test-case-type string linker-flag-prefix)
    (test-case-type optional-path seashell-login-logfile)
    (test-case-type nonnegative-real compiler-ttl)))
