<commit_before>module("About Reflection (topics/about_reflection.js)");

var A = function() {
    this.aprop = "A";    
};

var B = function() {
    this.bprop = "B";
};

B.prototype = new A();

test("typeof", function() {
    equals(typeof({}), __, 'what is the type of an empty object?');
    equals(typeof('apple'), __, 'what is the type of a string?');
    equals(typeof(-5), __, 'what is the type of -5?');
    equals(typeof(false), __, 'what is the type of false?');		
});

test("property enumeration", function() {
    var keys = [];
    var values = [];
    var person = {name: '<NAME>', age: 102, unemployed: true};
    for(propertyName in person) {
        keys.push(propertyName);
        values.push(person[propertyName]);
    }
    ok(keys.equalTo(['__','__','__']), 'what are the property names of the object?');
    ok(values.equalTo(['__',__,__]), 'what are the property values of the object?');
});

test("hasOwnProperty", function() {
    var b = new B();

    var keys = [];
    for (propertyName in b) {
        keys.push(propertyName);
    }
    equals(keys.length, __, 'how many elements are in the keys array?');
    ok(keys.equalTo([__, __]), 'what are the properties of the array?');

    // hasOwnProperty returns true if the parameter is a property directly on the object, 
    // but not if it is a property accessible via the prototype chain.
    var ownKeys = [];
    for(propertyName in b) {
        if (b.hasOwnProperty(propertyName)) {
            ownKeys.push(propertyName);
        }
    }
    equals(ownKeys.length, __, 'how many elements are in the ownKeys array?');
    ok(ownKeys.equalTo([__, __]), 'what are the own properties of the array?');
});

test("constructor property", function () {<commit_msg>fixed a problem in the hasOwnProperty test<commit_after>module("About Reflection (topics/about_reflection.js)");

var A = function() {
    this.aprop = "A";    
};

var B = function() {
    this.bprop = "B";
};

B.prototype = new A();

test("typeof", function() {
    equals(typeof({}), __, 'what is the type of an empty object?');
    equals(typeof('apple'), __, 'what is the type of a string?');
    equals(typeof(-5), __, 'what is the type of -5?');
    equals(typeof(false), __, 'what is the type of false?');		
});

test("property enumeration", function() {
    var keys = [];
    var values = [];
    var person = {name: '<NAME>', age: 102, unemployed: true};
    for(propertyName in person) {
        keys.push(propertyName);
        values.push(person[propertyName]);
    }
    ok(keys.equalTo(['__','__','__']), 'what are the property names of the object?');
    ok(values.equalTo(['__',__,__]), 'what are the property values of the object?');
});

test("hasOwnProperty", function() {
    var b = new B();

    var keys = [];
    for (propertyName in b) {
        keys.push(propertyName);
    }
    equals(keys.length, __, 'how many elements are in the keys array?');
    deepEqual(keys, [__, __], 'what are the properties of the array?');

    // hasOwnProperty returns true if the parameter is a property directly on the object, 
    // but not if it is a property accessible via the prototype chain.
    var ownKeys = [];
    for(propertyName in b) {
        if (b.hasOwnProperty(propertyName)) {
            ownKeys.push(propertyName);
        }
    }
    equals(ownKeys.length, __, 'how many elements are in the ownKeys array?');
    deepEqual(ownKeys, [__], 'what are the own properties of the array?');
});

test("constructor property", function () {
{'fraction_non_alphanumeric': 0.15702479338842976, 'fraction_numerical': 0.002849814762040467, 'mean_word_length': 3.249394673123487, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3486212', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1057, 'n_words': 348}