<commit_before>(in-package #:test-exercises)

;; for v2 test running
(pushnew :xlisp-test *features*)

(defun test-v2-exercise (data)
  (let ((test-files (aget :test (aget :files data)))
        (solution-files (aget :solution (aget :files data)))
        (exemplar-files (or (aget :exemplar (aget :files data))
                            (aget :example (aget :files data)))))
    (unwind-protect
         (progn
           (dolist (f (append solution-files exemplar-files test-files))
             (load-exercise-file data f))
           (list
            (let ((lisp-unit:*summarize-results* nil))
              (lisp-unit:run-tests :all (find-exercise-package data :test t)))))
      (delete-package (find-exercise-package data :test t))
      (delete-package (find-exercise-package data)))))

(defun test-v3-exercise (data)
  (let ((test-files (aget :test (aget :files data)))
        (exemplar-files (aget :exemplar (aget :files data))))

    (unwind-protect
         (progn<commit_msg>V3 practice exercises have an example file list not exemplar<commit_after>(in-package #:test-exercises)

;; for v2 test running
(pushnew :xlisp-test *features*)

(defun example-files (data)
  (or (aget :exemplar (aget :files data))
      (aget :example (aget :files data))))

(defun test-v2-exercise (data)
  (let ((test-files (aget :test (aget :files data)))
        (solution-files (aget :solution (aget :files data)))
        (exemplar-files (example-files data)))
    (unwind-protect
         (progn
           (dolist (f (append solution-files exemplar-files test-files))
             (load-exercise-file data f))
           (list
            (let ((lisp-unit:*summarize-results* nil))
              (lisp-unit:run-tests :all (find-exercise-package data :test t)))))
      (delete-package (find-exercise-package data :test t))
      (delete-package (find-exercise-package data)))))

(defun test-v3-exercise (data)
  (let ((test-files (aget :test (aget :files data)))
        (exemplar-files (example-files data)))
    (unwind-protect
         (progn
{'fraction_non_alphanumeric': 0.14711632453567938, 'fraction_numerical': 0.003421309872922776, 'mean_word_length': 2.7697974217311234, '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': '7560340', 'n_tokens_mistral': 686, 'n_tokens_neox': 664, 'n_words': 178}