<commit_before>; Copyright (c) 2009, <NAME>. All rights reserved.

; json test

(use json)

(define (test:json)
  (let ((json-object (json:parse "{\"two\":[\"one\",\"two\",\"three\"],\"one\":\"one\"}"))
        (json-array (json:parse "[\"one\",{\"two\":2},\"three\"]")))
    (check (json:to_json json-object) => "{\"two\":[\"one\",\"two\",\"three\"],\"one\":\"one\"}")
    (check (json:object? json-object) => #t) 
    (check (json:object-ref json-object "one") => "one")
    (check (json:array? (json:object-ref json-object "two")) => #t)
    (check (json:array-map (lambda (e) e) (json:object-ref json-object "two")) => '("one" "two" "three"))
    (check (length 
             (json:object-map
               (lambda (k v)
                 (cond ((equal? k "two") (check (json:array? v) => #t))
                       ((equal? k "one") (check v => "one")))
                 (list k v))
               json-object)) 
           => 2)<commit_msg>additional tests<commit_after>; Copyright (c) 2009, <NAME>. All rights reserved.

; json test

(use json)

(define (test:json)
  (let ((json-object (json:parse "{\"two\":[\"one\",\"two\",\"three\"],\"one\":\"one\"}"))
        (json-array (json:parse "[\"one\",{\"two\":2},\"three\"]")))
    (check (json:object? (json:parse "{\"two\":[\"one\",\"two\",\"three\"],\"one\":\"one\",\"three\":true}")) => #t)
    (check (json:array? (json:parse "[\"one\",{\"two\":false},\"three\"]")) => #t)
    (check (json:to_json json-object) => "{\"two\":[\"one\",\"two\",\"three\"],\"one\":\"one\"}")
    (check (json:object? json-object) => #t) 
    (check (json:object-ref json-object "one") => "one")
    (check (json:array? (json:object-ref json-object "two")) => #t)
    (check (json:array-map (lambda (e) e) (json:object-ref json-object "two")) => '("one" "two" "three"))
    (check (length 
             (json:object-map
               (lambda (k v)
                 (cond ((equal? k "two") (check (json:array? v) => #t))
                       ((equal? k "one") (check v => "one")))
                 (list k v))
               json-object)) 
           => 2)
{'fraction_non_alphanumeric': 0.2765855984740105, 'fraction_numerical': 0.005722460658082976, 'mean_word_length': 2.485049833887043, 'pattern_counts': {'":': 14, '<': 5, '<?xml version=': 0, '>': 23, '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': '7559787', 'n_tokens_mistral': 746, 'n_tokens_neox': 728, 'n_words': 162}