<?xml version = "1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">

<head>
	<title>NDN Name</title>
	
	<script type="text/javascript" src="../Helper.js"></script>

	<script type="text/javascript">
	
function testName() {
    var result = document.getElementById('result');
    result.innerHTML = "";
    
    var comp1 = new Uint8Array(1); 
    comp1.set(['.'.charCodeAt(0)]);
    
    var ab2 = new ArrayBuffer(4); 
    var comp2 = new Uint8Array(ab2); 
    comp2.set([0x00, 0x01, 0x02, 0x03]);

    // \u00E9 is e with accent.
    var entree = "entr\u00E9e";

    // When Name constructor is passed an array, each item is a name component represented with ArrayBuffer, 
    //   typed array, or string (parsed as UTF-8)
    var name1 = new Name([entree, comp1, ab2]);
    var name1Uri = name1.to_uri();
    var name1UriExpected = "/entr%C3%A9e/..../%00%01%02%03";
    result.innerHTML += "Name from '" + entree + "', Uint8Array of '.' and ArrayBuffer of 0,1,2,3:<br>";
    if (name1Uri == name1UriExpected)
        result.innerHTML += "SUCCESS: " + name1Uri + ".<br>";
    else
        result.innerHTML += "ERROR: got " + name1Uri + ", expected " + name1UriExpected + " .<br>";

    result.innerHTML += "Compare with same Name from '" + entree + "', '.' and ArrayBuffer:<br>";
    // Equivalent with name1
    var name2 = new Name([entree, ".", comp2]);
    if (name2.components.length != name1.components.length)
        result.innerHTML += "ERROR: Got name with " + name2.components.length + 
            " components, expected " + name1.components.length + ".<br>";
    else {
        var allEqual = true;
        for (var i = 0; i < name1.components.length; ++i) {
            if (!DataUtils.arraysEqual(name1.components[i], name2.components[i])) {
                allEqual = false;
                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
            }
        }
        if (allEqual)
            result.innerHTML += "SUCCESS: Names are equal.<br>";
    }
    
    result.innerHTML += "Compare with same Name from URI:<br>";
    // Equivalent with name1; when Name constructor is passed a string, it is treated as a URI
    var name3 = new Name("/entr%C3%A9e/..../%00%01%02%03");
    if (name3.components.length != name1.components.length)
        result.innerHTML += "ERROR: Got name with " + name3.components.length + 
            " components, expected " + name1.components.length + ".<br>";
    else {
        var allEqual = true;
        for (var i = 0; i < name1.components.length; ++i) {
            if (!DataUtils.arraysEqual(name1.components[i], name3.components[i])) {
                allEqual = false;
                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
            }
        }
        if (allEqual)
            result.innerHTML += "SUCCESS: Names are equal.<br>";
    }    
    
    result.innerHTML += "Compare with Name prefix of first 2 components:<br>";
    // Returns new Name([entree, "."])
    var name4 = name2.getPrefix(2);
    if (name4.components.length != 2)
        result.innerHTML += "ERROR: Got name with " + name4.components.length + 
            " components, expected 2.<br>";
    else {
        var allEqual = true;
        for (var i = 0; i < name4.components.length; ++i) {
            if (!DataUtils.arraysEqual(name1.components[i], name4.components[i])) {
                allEqual = false;
                result.innerHTML += "ERROR: Names differ at component at index " + i + ".<br>";
            }
        }
        if (allEqual)
            result.innerHTML += "SUCCESS: First 2 components are equal: " + name4.to_uri() + " .<br>";
    }    
    
    result.innerHTML += "Check with Name component at index 2:<br>";
    // Returns ArrayBuffer of "%00%01%02%03"
    var component2Out = new Uint8Array(name1.getComponent(2));
    if (DataUtils.arraysEqual(component2Out, comp2))
        result.innerHTML += "SUCCESS: Components at index 2 are equal.<br>";
    else
        result.innerHTML += "ERROR: Components at index 2 are different.<br>";
}

	</script>

</head>
<body >
	<button onclick="testName()">Test</button>
	
	<p id="result"></p>

</body>
</html>
