HaroonBadsha / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Problem with 2 dimensional array #392

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I have a problem when I try to initialize a 2 dimensional array. I have a 
TypeError: portionByAngle[i] is undefined (line 15) and I do not understand 
why, because the script is working on every degugers.

Here is the code :

PrizeWheel = TestCase("PrizeWheel");

PrizeWheel.prototype.testDetectSelPortionId = function() {
    var checkedSelPortionId = new Array();
    var expectedResults = "";
    var csvFile = new XMLHttpRequest();

    csvFile.open('GET', 'expectedResults.csv', false);
    csvFile.send();
    expectedResults = csvFile.responseText;

    var portionByAngle = expectedResults.split('\r\n');

    for(var i=0; i<=359; i++) {
        checkedSelPortionId[i] = portionByAngle[i].split(';');
    }

    for(i=0; i<=359; i++) {
        for(var j=0; j<=4; j++) {
            var portionNum = checkedSelPortionId[1][j];
            var selPortionId = detectSelPortionId(checkedSelPortionId[i][j], portionNum);

            assertEquals(checkedSelPortionId[i][j], selPortionId); // Assertion to test values equality
            jstestdriver.console.log(checkedSelPortionId, " == ", selPortionId); // Log msg to console if assert don't fail
        }
    }
};

Original issue reported on code.google.com by jimmy.po...@gmail.com on 17 Jul 2012 at 6:32