<commit_before>(in-package #:spasm-tests)

(use-package :spasm)


;;; unit tests for util.concat
;;;
(deftestsuite concat-test-case (spasm-test-suite) ())

(addtest (concat-test-case)
  test-concat
  (ensure-same "" (concat))
  (ensure-same "a" (concat "a"))
  (ensure-same "abc" (concat "a" "b" "c")))


;;; unit tests for util.*-pair
;;;
(deftestsuite pairs-test-case (spasm-test-suite) ())

(addtest (pairs-test-case)
  test-car-pair
    (ensure-same '(:a . 1) (car-pair '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same '(:a . 1) (car-pair '(:a 1)))
    (ensure-same '(nil) (car-pair '())))

(addtest (pairs-test-case)
  test-cdr-pairs
    (ensure-same
      '(:b 2 :c 3 :d 4 :e 5)
      (cdr-pairs '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same nil (cdr-pairs '(:a 1)))
    (ensure-same nil (cdr-pairs '())))

(addtest (pairs-test-case)
  test-get-pairs
    (ensure-same
      '((:a . 1) (:b . 2) (:c . 3) (:d . 4) (:e . 5))
      (get-pairs '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same '(:a . 1) (get-pairs '(:a 1)))
    (ensure-same '(nil) (car-pair '())))
<commit_msg>Fixed unit tests to use plists instead of alists.<commit_after>(in-package #:spasm-tests)

(use-package :spasm)


;;; unit tests for util.concat
;;;
(deftestsuite concat-test-case (spasm-test-suite) ())

(addtest (concat-test-case)
  test-concat
  (ensure-same "" (concat))
  (ensure-same "a" (concat "a"))
  (ensure-same "abc" (concat "a" "b" "c")))


;;; unit tests for util.*-pair
;;;
(deftestsuite pairs-test-case (spasm-test-suite) ())

(addtest (pairs-test-case)
  test-car-pair
    (ensure-same '(:a . 1) (car-pair '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same '(:a . 1) (car-pair '(:a 1)))
    (ensure-same '(nil) (car-pair '())))

(addtest (pairs-test-case)
  test-cdr-pairs
    (ensure-same
      '(:b 2 :c 3 :d 4 :e 5)
      (cdr-pairs '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same nil (cdr-pairs '(:a 1)))
    (ensure-same nil (cdr-pairs '())))

(addtest (pairs-test-case)
  test-get-pairs
    (ensure-same
      '((:a 1) (:b 2) (:c 3) (:d 4) (:e 5))
      (get-pairs '(:a 1 :b 2 :c 3 :d 4 :e 5)))
    (ensure-same '((:a 1)) (get-pairs '(:a 1)))
    (ensure-same nil (get-pairs '())))

{'fraction_non_alphanumeric': 0.23551057957681693, 'fraction_numerical': 0.027598896044158234, 'mean_word_length': 2.856382978723404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6765724', 'n_tokens_mistral': 1024, 'n_tokens_neox': 951, 'n_words': 256}