/* -------- TESTS --------- */ var tests = [ '', 'M-11.11,-22 L.33-44 ac55 66 h77 M88 .99 Z', 'M500,500 L500,200 L800,500 z M400,600 L400,900 L100,600 z', 'M70.491,50.826c-2.232,1.152-6.913,2.304-12.817,2.304c-13.682,0-23.906-8.641-23.906-24.626' + 'c0-15.266,10.297-25.49,25.346-25.49c5.977,0,9.865,1.296,11.521,2.16l-1.584,5.112C66.747,9.134,63.363,8.27,59.33,8.27' + 'c-11.377,0-18.938,7.272-18.938,20.018c0,11.953,6.841,19.514,18.578,19.514c3.888,0,7.777-0.792,10.297-2.016L70.491,50.826z', 'M10,10', 'Z' ]; tests.forEach(function(test) { console.log('----'); console.log('source:', test || ''); console.log('encoded:'); svgPathToCommands(test).forEach(function(command) { console.log(command.marker, command.values); }); console.log('decoded:', commandsToSvgPath(svgPathToCommands(test)) || ''); });