<commit_before><html>
<head>
  <script src="../lib/OpenLayers.js"></script>
  <script type="text/javascript"><!--
    var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
    var map; 
    function test_01_Util_getImagesLocation (t) {
        t.plan( 1 );
        t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
                    "getImagesLocation()" );
    }

    function test_02_Util_Strings(t) {
        t.plan(5);
        
        var str = "  chicken pox  ";

        t.ok(str.contains("chicken"), "contains() function correctly finds an embedded string");
        t.ok(!str.contains("marsupial"), "contains() function correctly does not finds an random string");
        

        var trimmedStr = str.trim();        

        t.eq(trimmedStr, "chicken pox", "String.trim works correctly");

        t.eq(trimmedStr.startsWith("chicken"), true, "String.startsWith correctly finds chicken");
        t.eq(trimmedStr.startsWith("dolphin"), false, "String.startsWith correctly does not find turkey");


    }

    function test_03_Util_Array(t) {
        t.plan( 5 );

        var array = new Array(1,2,3,4,5);

        array.remove(3);
        t.eq( array.toString(), "1,2,4,5", "array.remove works");    

        copy = array.clone();
        t.eq( copy.toString(), "1,2,4,5", "array.clone() works");    
        array.push(7);
        t.eq( copy.toString(), "1,2,4,5", "changing a value in the copied array doesnt affect the new array");    

        
        t.eq( copy.indexOf(5), 3, "indexOf function returns index of value in an array");    
        t.eq( copy.indexOf(75), -1, "indexOf function returns -1 when element not found in array");    
        
    }

    function test_04_Util_createDiv(t) {
        t.plan( 20 );

        var id = "boo";
        var px = new OpenLayers.Pixel(5,5);
        var sz = new OpenLayers.Size(10,10);
        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var position = "absolute";
        var border = "13px solid";
        var overflow = "hidden";

        var div = OpenLayers.Util.createDiv(id, px, sz, img, position, border, overflow);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.eq( div.id, id, "div.id set correctly");    
        t.eq( div.style.left, px.x + "px", "div.style.left set correctly");    
        t.eq( div.style.top, px.y + "px", "div.style.top set correctly");    

        t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");    
        t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");    

        t.eq( div.style.backgroundImage, "url(" + img + ")", "div.style.backgroundImage correctly");    

        t.eq( div.style.position, position, "div.style.positionset correctly");    
        t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");    
        t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");    

        //test defaults
        var div = OpenLayers.Util.createDiv();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.ok( (div.id != ""), "div.id set correctly");    
        t.eq(div.style.left, "", "div.style.left set correctly");    
        t.eq(div.style.top, "", "div.style.top set correctly");    

        t.eq( div.style.width, "", "div.style.width set correctly");    
        t.eq( div.style.height, "", "div.style.height set correctly");    

        t.eq(div.style.backgroundImage, "", "div.style.backgroundImage correctly");    

        t.eq( div.style.position, "absolute", "div.style.positionset correctly");    
        t.eq( div.style.border, "", "div.style.border set correctly");    
        t.eq(div.style.overflow, "", "div.style.overflow set correctly");    

    }

    function test_05_Util_createImage(t) {
        t.plan( 18 );

        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var sz = new OpenLayers.Size(10,10);
        var xy = new OpenLayers.Pixel(5,5);
        var position = "absolute";
        var id = "boo";
        var border = "1px solid";

        var image = OpenLayers.Util.createImage(id, xy, sz, img, position, border);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
        t.eq( image.id, id, "image.id set correctly");    
        t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");    
        t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");    

        t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    

        t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");    
        t.eq( image.src, img, "image.style.backgroundImage correctly");    
        t.eq( image.style.position, position, "image.style.positionset correctly");    

        //test defaults
        var image = OpenLayers.Util.createImage();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
        t.ok( (image.id != ""), "image.id set to something");    
        t.eq( image.style.left, "", "image.style.left set correctly");    
        t.eq( image.style.top, "", "image.style.top set correctly");    

        t.eq( image.style.width, "", "image.style.width set correctly");    
        t.eq( image.style.height, "", "image.style.height set correctly");    

        t.ok((image.style.border == ""), "image.style.border set correctly");    
        t.eq(image.src, "", "image.style.backgroundImage correctly");    
        t.eq( image.style.position, "relative", "image.style.positionset correctly");    

    }

    function test_06_Util_applyDefaults(t) {
    
        t.plan(4);
        
        var to = { a: "abra",
                   b: "blorg"
                 };

        var from = { b: "zoink",
                     c: "press"
                   };

        to = OpenLayers.Util.applyDefaults(to, from);

        t.ok( to instanceof Object, " applyDefaults returns an object");
        t.eq( to["a"], "abra", "key present in to but not from maintained");
        t.eq( to["b"], "blorg", "key present in to and from, maintained in to");
        t.eq( to["c"], "press", "key present in from and not to successfully copied to to");
    }

    function test_07_Util_getParameterString(t) {
        t.plan( 1 );
<commit_msg>r1255 broke a test. fixed.<commit_after><html>
<head>
  <script src="../lib/OpenLayers.js"></script>
  <script type="text/javascript"><!--
    var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
    var map; 
    function test_01_Util_getImagesLocation (t) {
        t.plan( 1 );
        t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
                    "getImagesLocation()" );
    }

    function test_02_Util_Strings(t) {
        t.plan(5);
        
        var str = "  chicken pox  ";

        t.ok(str.contains("chicken"), "contains() function correctly finds an embedded string");
        t.ok(!str.contains("marsupial"), "contains() function correctly does not finds an random string");
        

        var trimmedStr = str.trim();        

        t.eq(trimmedStr, "chicken pox", "String.trim works correctly");

        t.eq(trimmedStr.startsWith("chicken"), true, "String.startsWith correctly finds chicken");
        t.eq(trimmedStr.startsWith("dolphin"), false, "String.startsWith correctly does not find turkey");


    }

    function test_03_Util_Array(t) {
        t.plan( 5 );

        var array = new Array(1,2,3,4,5);

        array.remove(3);
        t.eq( array.toString(), "1,2,4,5", "array.remove works");    

        copy = array.clone();
        t.eq( copy.toString(), "1,2,4,5", "array.clone() works");    
        array.push(7);
        t.eq( copy.toString(), "1,2,4,5", "changing a value in the copied array doesnt affect the new array");    

        
        t.eq( copy.indexOf(5), 3, "indexOf function returns index of value in an array");    
        t.eq( copy.indexOf(75), -1, "indexOf function returns -1 when element not found in array");    
        
    }

    function test_04_Util_createDiv(t) {
        t.plan( 20 );

        var id = "boo";
        var px = new OpenLayers.Pixel(5,5);
        var sz = new OpenLayers.Size(10,10);
        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var position = "absolute";
        var border = "13px solid";
        var overflow = "hidden";

        var div = OpenLayers.Util.createDiv(id, px, sz, img, position, border, overflow);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.eq( div.id, id, "div.id set correctly");    
        t.eq( div.style.left, px.x + "px", "div.style.left set correctly");    
        t.eq( div.style.top, px.y + "px", "div.style.top set correctly");    

        t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");    
        t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");    

        t.eq( div.style.backgroundImage, "url(" + img + ")", "div.style.backgroundImage correctly");    

        t.eq( div.style.position, position, "div.style.positionset correctly");    
        t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");    
        t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");    

        //test defaults
        var div = OpenLayers.Util.createDiv();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
        t.ok( (div.id != ""), "div.id set correctly");    
        t.eq(div.style.left, "", "div.style.left set correctly");    
        t.eq(div.style.top, "", "div.style.top set correctly");    

        t.eq( div.style.width, "", "div.style.width set correctly");    
        t.eq( div.style.height, "", "div.style.height set correctly");    

        t.eq(div.style.backgroundImage, "", "div.style.backgroundImage correctly");    

        t.eq( div.style.position, "absolute", "div.style.positionset correctly");    
        t.eq( div.style.border, "", "div.style.border set correctly");    
        t.eq(div.style.overflow, "", "div.style.overflow set correctly");    

    }

    function test_05_Util_createImage(t) {
        t.plan( 18 );

        var img = "http://www.openlayers.org/images/OpenLayers.trac.png";
        var sz = new OpenLayers.Size(10,10);
        var xy = new OpenLayers.Pixel(5,5);
        var position = "absolute";
        var id = "boo";
        var border = "1px solid";

        var image = OpenLayers.Util.createImage(id, xy, sz, img, position, border);

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
        t.eq( image.id, id, "image.id set correctly");    
        t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");    
        t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");    

        t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");    
        t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    

        t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");    
        t.eq( image.src, img, "image.style.backgroundImage correctly");    
        t.eq( image.style.position, position, "image.style.positionset correctly");    

        //test defaults
        var image = OpenLayers.Util.createImage();

        if (!isMozilla)
            t.ok( true, "skipping element test outside of Mozilla");
        else
            t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
        t.ok( (image.id != ""), "image.id set to something");    
        t.eq( image.style.left, "", "image.style.left set correctly");    
        t.eq( image.style.top, "", "image.style.top set correctly");    

        t.eq( image.style.width, "", "image.style.width set correctly");    
        t.eq( image.style.height, "", "image.style.height set correctly");    

        t.ok((image.style.border == ""), "image.style.border set correctly");    
        t.eq(image.src, "", "image.style.backgroundImage correctly");    
        t.eq( image.style.position, "relative", "image.style.positionset correctly");    

    }

    function test_06_Util_applyDefaults(t) {
    
        t.plan(4);
        
        var to = { a: "abra",
                   b: "blorg"
                 };

        var from = { b: "zoink",
                     c: "press"
                   };

        OpenLayers.Util.applyDefaults(to, from);

        t.ok( to instanceof Object, " applyDefaults returns an object");
        t.eq( to["a"], "abra", "key present in to but not from maintained");
        t.eq( to["b"], "blorg", "key present in to and from, maintained in to");
        t.eq( to["c"], "press", "key present in from and not to successfully copied to to");
    }

    function test_07_Util_getParameterString(t) {
        t.plan( 1 );

{'fraction_non_alphanumeric': 0.1511995402959345, 'fraction_numerical': 0.009768711392041373, 'mean_word_length': 2.228147461163923, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6112982', 'n_tokens_mistral': 4426, 'n_tokens_neox': 4249, 'n_words': 1089}