<commit_before>(in-package #:sicl-sequences-test)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Function find

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 1|
  (let ((element '(a)))
    (assert-eq
     nil
     (find element '() :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 2|
  (let ((element '(a)))
    (assert-eq
     nil
     (find element (list (list 'a)) :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 3|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 4|
  (let ((element '(a)))
    (assert-error
     'type-error
     (find element (list* (list 'a) (list 'a) (list 'a) 'b) :test #'eq))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 1|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq :start 1))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 2|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq :start 1))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 3|
  (let ((element '(a)))
    (assert-error
     'type-error
     (find element (list* (list 'a) element (list 'a)  'b) :test #'eq :start 2))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Function find-if

(define-test find-if-list.1
  (assert-equal 'nil
                (find-if #'identity ())))

(define-test find-if-list.2
  (assert-equal 'a
                (find-if #'identity '(a))))<commit_msg>More tests for function find.<commit_after>(in-package #:sicl-sequences-test)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Function find

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 1|
  (let ((element '(a)))
    (assert-eq
     nil
     (find element '() :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 2|
  (let ((element '(a)))
    (assert-eq
     nil
     (find element (list (list 'a)) :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 3|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq))))

(define-test |find seq-type=list start=nil from-end=nil test=eq key=identity 4|
  (let ((element '(a)))
    (assert-error
     'type-error
     (find element (list* (list 'a) (list 'a) (list 'a) 'b) :test #'eq))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 1|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq :start 1))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 2|
  (let ((element '(a)))
    (assert-eq
     element
     (find element (list (list 'a) element (list 'a)) :test #'eq :start 1))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=identity 3|
  (let ((element '(a)))
    (assert-error
     'type-error
     (find element (list* (list 'a) element (list 'a)  'b) :test #'eq :start 2))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=other 1|
  (let ((element '(a)))
    (assert-eq
     element
     (car (find element (list (list (list 'a)) (list element) (list (list 'a)))
		:test #'eq :start 1 :key #'car)))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=other 2|
  (let ((element '(a)))
    (assert-eq
     element
     (car (find element (list (list (list 'a)) (list element) (list (list 'a)))
		:test #'eq :start 1 :key #'car)))))

(define-test |find seq-type=list start=other from-end=nil test=eq key=other 3|
  (let ((element '(a)))
    (assert-error
     'type-error
     (car (find element (list* (list (list 'a)) (list element) (list (list 'a)) 'b)
		:test #'eq :start 2 :key #'car)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Function find-if

(define-test find-if-list.1
  (assert-equal 'nil
                (find-if #'identity ())))

(define-test find-if-list.2
  (assert-equal 'a
                (find-if #'identity '(a))))
{'fraction_non_alphanumeric': 0.24067872292922526, 'fraction_numerical': 0.006697923643670462, 'mean_word_length': 3.6861924686192467, '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': '4893650', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1605, 'n_words': 457}