<commit_before>;
;  (C) Copyright 2016  <NAME>
;
;  All rights reserved. This program and the accompanying materials
;  are made available under the terms of the Eclipse Public License v1.0
;  which accompanies this distribution, and is available at
;  http://www.eclipse.org/legal/epl-v10.html
;
;  Contributors:
;      <NAME>
;

(ns zg.core-test
  (:require [clojure.test :refer :all]
            [zg.core :refer :all]))

;
; Common functions used by tests.
;

(defn callable?
    "Test if given function-name is bound to the real function."
    [function-name]
    (clojure.test/function? function-name))

;
; Tests for various functions
;

(deftest test-start-server-existence
    "Check that the zg.core/start-server definition exists."
    (testing "if the zg.core/start-server definition exists."
        (is (callable? 'zg.core/start-server))))

(deftest test-get-and-check-port-existence
    "Check that the zg.core/get-and-check-port definition exists."
    (testing "if the zg.core/get-and-check-port definition exists."
        (is (callable? 'zg.core/get-and-check-port))))

(deftest test-get-port-existence
    "Check that the zg.core/get-port definition exists."
    (testing "if the zg.core/get-port definition exists."
        (is (callable? 'zg.core/get-port))))

(deftest test--main-existence
    "Check that the zg.core/-main definition exists."
    (testing "if the zg.core/-main definition exists."
        (is (callable? 'zg.core/-main))))

<commit_msg>Three tests for get-port function<commit_after>;
;  (C) Copyright 2016  <NAME>
;
;  All rights reserved. This program and the accompanying materials
;  are made available under the terms of the Eclipse Public License v1.0
;  which accompanies this distribution, and is available at
;  http://www.eclipse.org/legal/epl-v10.html
;
;  Contributors:
;      <NAME>
;

(ns zg.core-test
  (:require [clojure.test :refer :all]
            [zg.core :refer :all]))

;
; Common functions used by tests.
;

(defn callable?
    "Test if given function-name is bound to the real function."
    [function-name]
    (clojure.test/function? function-name))

;
; Tests for various functions
;

(deftest test-start-server-existence
    "Check that the zg.core/start-server definition exists."
    (testing "if the zg.core/start-server definition exists."
        (is (callable? 'zg.core/start-server))))


(deftest test-get-and-check-port-existence
    "Check that the zg.core/get-and-check-port definition exists."
    (testing "if the zg.core/get-and-check-port definition exists."
        (is (callable? 'zg.core/get-and-check-port))))


(deftest test-get-port-existence
    "Check that the zg.core/get-port definition exists."
    (testing "if the zg.core/get-port definition exists."
        (is (callable? 'zg.core/get-port))))


(deftest test--main-existence
    "Check that the zg.core/-main definition exists."
    (testing "if the zg.core/-main definition exists."
        (is (callable? 'zg.core/-main))))

;
; Tests for function behaviours
;

(deftest test-get-port
    "Check the function zg.core/get-port."
    (testing "the function zg.core/get-port."
        (is (= (get-port "1")     "1"))
        (is (= (get-port "2")     "2"))
        (is (= (get-port "3000")  "3000"))
        (is (= (get-port "65534") "65534"))
        (is (= (get-port "65535") "65535"))))

(deftest test-get-port-special-cases
    "Check the function zg.core/get-port."
    (testing "the function zg.core/get-port."
        (is (= (get-port nil)     "3000"))
        (is (= (get-port "")      "3000"))
        (is (= (get-port 0)       "3000"))
        (is (= (get-port 1)       "3000"))
        (is (= (get-port 65535)   "3000"))
        (is (= (get-port 65536)   "3000"))))

(deftest test-get-port-negative
    "Check the function zg.core/get-port."
    (testing "the function zg.core/get-port."
        (is (thrown? AssertionError (get-port "0")))
        (is (thrown? AssertionError (get-port "-1")))
        (is (thrown? AssertionError (get-port "-2")))
        (is (thrown? AssertionError (get-port "65536")))
        (is (thrown? AssertionError (get-port "65537")))
        (is (thrown? AssertionError (get-port "1000000")))))



{'fraction_non_alphanumeric': 0.15081261950286806, 'fraction_numerical': 0.0248565965583174, 'mean_word_length': 2.867837338262477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1420741', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1398, 'n_words': 387}