<commit_before><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>
        hug.js - Tests I
    </title>
    <link rel="stylesheet" href="qunit/qunit.css" type="text/css"/>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>

<script type="text/javascript" src="../src/hug.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>

<script>
test('creating an object', function () {
    ok(hug(), 'hug() result is not falsy');
    notEqual(hug(), hug(), 'hug() results are not the same');
});

test('wrapping native objects: number', function () {
    var subject, wrapped;

    subject = 13;
    wrapped = hug(subject);

    ok(subject, 'hug(number) is not falsy');
    notEqual(subject, wrapped, 'hug(number) is not the number');
    equal(wrapped(), subject, 'hug(number)() gets the number');
    equal(wrapped('value')(), subject, 'hug(number)("value")() gets the number');
});

test('wrapping native objects: string', function () {
    var subject, wrapped;

    subject = 'hello world';
    wrapped = hug(subject);

    ok(subject, 'hug(string) is not falsy');
    notEqual(subject, wrapped, 'is not the same');
    equal(wrapped(), subject, 'accessing wrapped string');
    equal(wrapped('value')(), subject, 'accessing wrapped string by #value');
    equal(wrapped('length'), subject.length, 'accessing wrapped string properties');
});

test('wrapping native objects: Object', function () {
    var subject, wrapped;

    subject = { foo: 'bar' };
    wrapped = hug(subject);

    ok(wrapped, 'wrapped object is not falsy');
    notEqual(subject, wrapped, 'subject and wrapper are not the same');
    equal(wrapped('foo'), subject.foo, 'accessing wrapped properties');
});

test('object.#id', function () {
    var object = hug();

    equal(typeof object('id'), 'function', 'object.#id is a function');
    equal(typeof object('id')(), 'number', 'the id is numeric');
    equal(object('id')() + 1, hug()('id')(), 'the id is autoincremental');<commit_msg>Fixed wrong test cases (via @gnz)<commit_after><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>
        hug.js - Tests I
    </title>
    <link rel="stylesheet" href="qunit/qunit.css" type="text/css"/>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>

<script type="text/javascript" src="../src/hug.js"></script>
<script type="text/javascript" src="qunit/qunit.js"></script>

<script>
test('creating an object', function () {
    ok(hug(), 'hug() result is not falsy');
    notEqual(hug(), hug(), 'hug() results are not the same');
});

test('wrapping native objects: number', function () {
    var subject, wrapped;

    subject = 42;
    wrapped = hug(subject);

    ok(wrapped, 'hug(number) is not falsy');
    notEqual(subject, wrapped, 'hug(number) is not the number');
    equal(wrapped(), subject, 'hug(number)() gets the number');
    equal(wrapped('value')(), subject, 'hug(number)("value")() gets the number');
});

test('wrapping native objects: string', function () {
    var subject, wrapped;

    subject = 'hello world';
    wrapped = hug(subject);

    ok(wrapped, 'hug(string) is not falsy');
    notEqual(subject, wrapped, 'is not the same');
    equal(wrapped(), subject, 'accessing wrapped string');
    equal(wrapped('value')(), subject, 'accessing wrapped string by #value');
    equal(wrapped('length'), subject.length, 'accessing wrapped string properties');
});

test('wrapping native objects: Object', function () {
    var subject, wrapped;

    subject = { foo: 'bar' };
    wrapped = hug(subject);

    ok(wrapped, 'wrapped object is not falsy');
    notEqual(subject, wrapped, 'subject and wrapper are not the same');
    equal(wrapped('foo'), subject.foo, 'accessing wrapped properties');
});

test('object.#id', function () {
    var object = hug();

    equal(typeof object('id'), 'function', 'object.#id is a function');
    equal(typeof object('id')(), 'number', 'the id is numeric');
    equal(object('id')() + 1, hug()('id')(), 'the id is autoincremental');
{'fraction_non_alphanumeric': 0.18835952848722987, 'fraction_numerical': 0.0019646365422396855, 'mean_word_length': 4.303385416666667, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '3776831', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1292, 'n_words': 372}