mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
modify test cases to adjust lanes != total lane count
This commit is contained in:
+86
-103
@@ -102,27 +102,21 @@ _.extend(Way.prototype, {
|
||||
},
|
||||
|
||||
lanes: function() {
|
||||
|
||||
function parseTurnLanes(key, n){
|
||||
var validValues = [
|
||||
'left', 'slight_left', 'sharp_left', 'through', 'right', 'slight_right',
|
||||
'sharp_right', 'reverse', 'merge_to_left', 'merge_to_right', 'none'
|
||||
];
|
||||
var str = tags[key];
|
||||
if (!str) return;
|
||||
var parsedArray = str.split('|')
|
||||
.slice(0, n)
|
||||
.map(function (s) {
|
||||
if (s === '') s = 'none';
|
||||
return s.split(';')
|
||||
.map(function (d) {
|
||||
return validValues.indexOf(d) === -1 ? 'unknown': d;
|
||||
});
|
||||
});
|
||||
while (parsedArray.length < n) {
|
||||
parsedArray.push(['unknown']);
|
||||
function getLaneCount() {
|
||||
var count;
|
||||
// fill laneCount with defaults
|
||||
switch (tags.highway) {
|
||||
case 'trunk':
|
||||
case 'motorway':
|
||||
count = oneway ? 2 : 4;
|
||||
break;
|
||||
default:
|
||||
count = oneway ? 1 : 2;
|
||||
break;
|
||||
}
|
||||
return parsedArray;
|
||||
|
||||
if (tags.lanes) count = parseInt(tags.lanes);
|
||||
return count;
|
||||
}
|
||||
|
||||
function parseMaxspeed() {
|
||||
@@ -135,28 +129,6 @@ _.extend(Way.prototype, {
|
||||
}
|
||||
}
|
||||
|
||||
function parseMaxspeedLanes(key, n) {
|
||||
var str = tags[key];
|
||||
if (!str) return;
|
||||
var parsedArray = str.split('|')
|
||||
.slice(0, n)
|
||||
.map(function (s) {
|
||||
var m = parseInt(s);
|
||||
if (s === '' || m === maxspeed) return 'none';
|
||||
return _.isNaN(m) ? 'unknown': m;
|
||||
});
|
||||
while (parsedArray.length < n) {
|
||||
parsedArray.push('unknown');
|
||||
}
|
||||
return parsedArray;
|
||||
}
|
||||
|
||||
function parseVehicleLanes(key, n) {
|
||||
var str = tags[key];
|
||||
if (!str) return;
|
||||
var parsedArray
|
||||
}
|
||||
|
||||
function parseLaneDirections() {
|
||||
var forward = parseInt(tags['lanes:forward']);
|
||||
var backward = parseInt(tags['lanes:backward']);
|
||||
@@ -195,6 +167,36 @@ _.extend(Way.prototype, {
|
||||
};
|
||||
}
|
||||
|
||||
function parseTurnLanes(key){
|
||||
var validValues = [
|
||||
'left', 'slight_left', 'sharp_left', 'through', 'right', 'slight_right',
|
||||
'sharp_right', 'reverse', 'merge_to_left', 'merge_to_right', 'none'
|
||||
];
|
||||
var str = tags[key];
|
||||
if (!str) return;
|
||||
var parsedArray = str.split('|')
|
||||
.map(function (s) {
|
||||
if (s === '') s = 'none';
|
||||
return s.split(';')
|
||||
.map(function (d) {
|
||||
return validValues.indexOf(d) === -1 ? 'unknown': d;
|
||||
});
|
||||
});
|
||||
return parsedArray;
|
||||
}
|
||||
|
||||
function parseMaxspeedLanes(key) {
|
||||
var str = tags[key];
|
||||
if (!str) return;
|
||||
var parsedArray = str.split('|')
|
||||
.map(function (s) {
|
||||
var m = parseInt(s);
|
||||
if (s === '' || m === maxspeed) return 'none';
|
||||
return _.isNaN(m) ? 'unknown': m;
|
||||
});
|
||||
return parsedArray;
|
||||
}
|
||||
|
||||
function parseMiscLanes(key) {
|
||||
var validValues = [
|
||||
'yes', 'no', 'designated'
|
||||
@@ -209,7 +211,7 @@ _.extend(Way.prototype, {
|
||||
return parsedArray;
|
||||
}
|
||||
|
||||
function parsebicycleWay(key) {
|
||||
function parseBicycleWay(key) {
|
||||
var validValues = [
|
||||
'yes', 'no', 'designated', 'lane'
|
||||
];
|
||||
@@ -223,23 +225,6 @@ _.extend(Way.prototype, {
|
||||
return parsedArray;
|
||||
}
|
||||
|
||||
function getLaneCount() {
|
||||
var count;
|
||||
// fill laneCount with defaults
|
||||
switch (tags.highway) {
|
||||
case 'trunk':
|
||||
case 'motorway':
|
||||
count = oneway ? 2 : 4;
|
||||
break;
|
||||
default:
|
||||
count = oneway ? 1 : 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tags.lanes) count = parseInt(tags.lanes);
|
||||
return count;
|
||||
}
|
||||
|
||||
if (!this.tags.highway) return null;
|
||||
|
||||
var tags = this.tags;
|
||||
@@ -254,14 +239,14 @@ _.extend(Way.prototype, {
|
||||
|
||||
// parse the piped string 'x|y|z' format
|
||||
var turnLanes = {};
|
||||
turnLanes.unspecified = parseTurnLanes('turn:lanes', laneCount);
|
||||
turnLanes.forward = parseTurnLanes('turn:lanes:forward', forward);
|
||||
turnLanes.backward = parseTurnLanes('turn:lanes:backward', backward);
|
||||
turnLanes.unspecified = parseTurnLanes('turn:lanes');
|
||||
turnLanes.forward = parseTurnLanes('turn:lanes:forward');
|
||||
turnLanes.backward = parseTurnLanes('turn:lanes:backward');
|
||||
|
||||
var maxspeedLanes = {};
|
||||
maxspeedLanes.unspecified = parseMaxspeedLanes('maxspeed:lanes', laneCount);
|
||||
maxspeedLanes.forward = parseMaxspeedLanes('maxspeed:lanes:forward', forward);
|
||||
maxspeedLanes.backward = parseMaxspeedLanes('maxspeed:lanes:backward', backward);
|
||||
maxspeedLanes.unspecified = parseMaxspeedLanes('maxspeed:lanes');
|
||||
maxspeedLanes.forward = parseMaxspeedLanes('maxspeed:lanes:forward');
|
||||
maxspeedLanes.backward = parseMaxspeedLanes('maxspeed:lanes:backward');
|
||||
|
||||
var psvLanes = {};
|
||||
psvLanes.unspecified = parseMiscLanes('psv:lanes');
|
||||
@@ -289,36 +274,36 @@ _.extend(Way.prototype, {
|
||||
hgvLanes.backward = parseMiscLanes('hgv:lanes:backward');
|
||||
|
||||
var bicyclewayLanes = {};
|
||||
bicyclewayLanes.unspecified = parsebicycleWay('bicycleway:lanes');
|
||||
bicyclewayLanes.forward = parsebicycleWay('bicycleway:lanes:forward');
|
||||
bicyclewayLanes.backward = parsebicycleWay('bicycleway:lanes:backward');
|
||||
bicyclewayLanes.unspecified = parseBicycleWay('bicycleway:lanes');
|
||||
bicyclewayLanes.forward = parseBicycleWay('bicycleway:lanes:forward');
|
||||
bicyclewayLanes.backward = parseBicycleWay('bicycleway:lanes:backward');
|
||||
|
||||
// fill each undefined lanesArray's direction element with 'forward/bothways/backward'.
|
||||
smartFill(lanesArray, 'direction', _.fill(Array(forward), 'forward'));
|
||||
smartFill(lanesArray, 'direction', _.fill(Array(bothways), 'bothways'));
|
||||
smartFill(lanesArray, 'direction', _.fill(Array(backward), 'backward'));
|
||||
|
||||
// parse turn:lanes:forward/backward first
|
||||
|
||||
if (!oneway && this.tags['turn:lanes:forward'] && this.tags['turn:lanes:backward']) {
|
||||
smartFill(lanesArray, 'turnLane', turnLanesForward);
|
||||
// if both_ways fill it with null
|
||||
smartFill(lanesArray, 'turnLane', _.fill(Array(bothways), null));
|
||||
smartFill(lanesArray, 'turnLane', turnLanesBackward);
|
||||
}
|
||||
else if (this.tags['turn:lanes']) {
|
||||
smartFill(lanesArray, 'turnLane', turnLanes);
|
||||
}
|
||||
|
||||
// parse max speed
|
||||
if (!oneway && this.tags['maxspeed:lanes:forward'] && this.tags['maxspeed:lanes:backward']) {
|
||||
smartFill(lanesArray, 'maxspeed', maxspeedLanesForward);
|
||||
smartFill(lanesArray, 'maxspeed', _.fill(Array(bothways), null));
|
||||
smartFill(lanesArray, 'maxspeed', maxspeedLanesBackward);
|
||||
}
|
||||
else if (this.tags['maxspeed:lanes']) {
|
||||
smartFill(lanesArray, 'maxspeed', maxspeedLanes);
|
||||
}
|
||||
// smartFill(lanesArray, 'direction', _.fill(Array(forward), 'forward'));
|
||||
// smartFill(lanesArray, 'direction', _.fill(Array(bothways), 'bothways'));
|
||||
// smartFill(lanesArray, 'direction', _.fill(Array(backward), 'backward'));
|
||||
//
|
||||
// // parse turn:lanes:forward/backward first
|
||||
//
|
||||
// if (!oneway && this.tags['turn:lanes:forward'] && this.tags['turn:lanes:backward']) {
|
||||
// smartFill(lanesArray, 'turnLane', turnLanesForward);
|
||||
// // if both_ways fill it with null
|
||||
// smartFill(lanesArray, 'turnLane', _.fill(Array(bothways), null));
|
||||
// smartFill(lanesArray, 'turnLane', turnLanesBackward);
|
||||
// }
|
||||
// else if (this.tags['turn:lanes']) {
|
||||
// smartFill(lanesArray, 'turnLane', turnLanes);
|
||||
// }
|
||||
//
|
||||
// // parse max speed
|
||||
// if (!oneway && this.tags['maxspeed:lanes:forward'] && this.tags['maxspeed:lanes:backward']) {
|
||||
// smartFill(lanesArray, 'maxspeed', maxspeedLanesForward);
|
||||
// smartFill(lanesArray, 'maxspeed', _.fill(Array(bothways), null));
|
||||
// smartFill(lanesArray, 'maxspeed', maxspeedLanesBackward);
|
||||
// }
|
||||
// else if (this.tags['maxspeed:lanes']) {
|
||||
// smartFill(lanesArray, 'maxspeed', maxspeedLanes);
|
||||
// }
|
||||
|
||||
return {
|
||||
metadata: {
|
||||
@@ -328,17 +313,15 @@ _.extend(Way.prototype, {
|
||||
backward: backward,
|
||||
bothways: bothways,
|
||||
turnLanes: turnLanes,
|
||||
turnLanesForward: turnLanesForward,
|
||||
turnLanesBackward: turnLanesBackward,
|
||||
maxspeed: maxspeed,
|
||||
maxspeedLanes: maxspeedLanes,
|
||||
maxspeedLanesForward: maxspeedLanesForward,
|
||||
maxspeedLanesBackward: maxspeedLanesBackward,
|
||||
vehicleLanes: vehicleLanes,
|
||||
vehicleLanesForward: vehicleLanesForward,
|
||||
vehicleLanesBackward: vehicleLanesBackward
|
||||
},
|
||||
lanes: lanesArray
|
||||
psvLanes: psvLanes,
|
||||
busLanes: busLanes,
|
||||
taxiLanes: taxiLanes,
|
||||
hovLanes: hovLanes,
|
||||
hgvLanes: hgvLanes,
|
||||
bicyclewayLanes: bicyclewayLanes
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
+69
-90
@@ -756,7 +756,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
|
||||
describe('oneway tags', function() {
|
||||
it('returns correctlys oneway when tagged as oneway', function() {
|
||||
it('returns correctly oneway when tagged as oneway', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', oneway: 'yes' }}).lanes().metadata.oneway, 'residential lanes')
|
||||
.to.be.true;
|
||||
expect(iD.Way({tags: { highway: 'residential', oneway: 'no' }}).lanes().metadata.oneway, 'residential lanes')
|
||||
@@ -766,7 +766,7 @@ describe('iD.Way', function() {
|
||||
|
||||
describe('lane direction', function() {
|
||||
|
||||
it('returns correctlys the lane:forward and lane:backward count', function() {
|
||||
it('returns correctly the lane:forward and lane:backward count', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 2, 'lanes:forward': 1, 'lanes:backward': 1 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 2,
|
||||
@@ -785,7 +785,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys count under total count if erroneous values are supplied', function() {
|
||||
it('returns correctly the count if erroneous values are supplied', function() {
|
||||
expect(iD.Way({tags: { highway: 'trunk', lanes: 2, 'lanes:forward': 3 }}).lanes().metadata, 'trunk lanes')
|
||||
.to.include({
|
||||
count: 2,
|
||||
@@ -796,7 +796,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys forward count when oneway=yes', function() {
|
||||
it('returns correctly forward count when oneway=yes', function() {
|
||||
expect(iD.Way({tags: { highway: 'trunk', lanes: 2, oneway: 'yes' }}).lanes().metadata, 'trunk lanes')
|
||||
.to.include({
|
||||
count: 2,
|
||||
@@ -807,7 +807,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys backward count the when oneway=-1', function() {
|
||||
it('returns correctly backward count the when oneway=-1', function() {
|
||||
expect(iD.Way({tags: { highway: 'primary', lanes: 4, oneway: '-1' }}).lanes().metadata, 'primary lanes')
|
||||
.to.include({
|
||||
count: 4,
|
||||
@@ -840,7 +840,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys forward count if only backward is supplied', function() {
|
||||
it('returns correctly forward count if only backward is supplied', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 3, 'lanes:backward': 1, }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 3,
|
||||
@@ -859,7 +859,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys backward count if only forward is supplied', function() {
|
||||
it('returns correctly backward count if only forward is supplied', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 3, 'lanes:forward': 1, }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 3,
|
||||
@@ -878,7 +878,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys backward count if forward and both_ways are supplied', function() {
|
||||
it('returns correctly backward count if forward and both_ways are supplied', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 3, 'lanes:forward': 1, 'lanes:both_ways': 1 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 3,
|
||||
@@ -897,7 +897,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys forward count if backward and both_ways are supplied', function() {
|
||||
it('returns correctly forward count if backward and both_ways are supplied', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 3, 'lanes:backward': 1, 'lanes:both_ways': 1 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 3,
|
||||
@@ -916,7 +916,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys the lane:both_ways count as 1', function() {
|
||||
it('returns correctly the lane:both_ways count as 1', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 2, 'lanes:forward': 1, 'lanes:both_ways': 1 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 2,
|
||||
@@ -927,7 +927,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys when lane:both_ways>1', function() {
|
||||
it('returns correctly when lane:both_ways>1', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 5, 'lanes:forward': 2, 'lanes:both_ways': 2, 'lanes:backward': 2 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 5,
|
||||
@@ -938,7 +938,7 @@ describe('iD.Way', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correctlys when lane:both_ways is 0 or Not a Number', function() {
|
||||
it('returns correctly when lane:both_ways is 0 or Not a Number', function() {
|
||||
expect(iD.Way({tags: { highway: 'residential', lanes: 5, 'lanes:forward': 2, 'lanes:both_ways': 0, 'lanes:backward': 3 }}).lanes().metadata, 'residential lanes')
|
||||
.to.include({
|
||||
count: 5,
|
||||
@@ -959,7 +959,7 @@ describe('iD.Way', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('lanes array', function() {
|
||||
describe.skip('lanes array', function() {
|
||||
it('should have correct number of direction elements', function() {
|
||||
var lanes = iD.Way({tags: { highway: 'residential', lanes: 5, 'lanes:forward': 2, 'lanes:both_ways': 0, 'lanes:backward': 3 }}).lanes().lanes;
|
||||
var forward = lanes.filter(function(l) {
|
||||
@@ -1002,7 +1002,7 @@ describe('iD.Way', function() {
|
||||
'turn:lanes': 'none|slight_right'
|
||||
}
|
||||
}).lanes().metadata;
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([
|
||||
['none'], ['slight_right']
|
||||
]);
|
||||
@@ -1018,7 +1018,7 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([
|
||||
['none'], ['slight_right']
|
||||
]);
|
||||
@@ -1035,11 +1035,11 @@ describe('iD.Way', function() {
|
||||
'turn:lanes:backward': 'none|through|through;slight_right',
|
||||
}
|
||||
}).lanes().metadata;
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.deep.equal([
|
||||
['slight_left']
|
||||
]);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.deep.equal([
|
||||
['none'], ['through'], ['through', 'slight_right']
|
||||
]);
|
||||
@@ -1055,16 +1055,7 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes();
|
||||
|
||||
expect(lanesData.metadata.turnLanes)
|
||||
.to.deep.equal([
|
||||
['slight_left', 'reverse', 'left'],
|
||||
['slight_left', 'left', 'through'],
|
||||
['through'],
|
||||
['none'],
|
||||
['through', 'right']
|
||||
]);
|
||||
|
||||
expect(lanesData.lanes.map(function(l) { return l.turnLane; }))
|
||||
expect(lanesData.metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([
|
||||
['slight_left', 'reverse', 'left'],
|
||||
['slight_left', 'left', 'through'],
|
||||
@@ -1086,25 +1077,17 @@ describe('iD.Way', function() {
|
||||
'turn:lanes:backward': 'none|through;left'
|
||||
}
|
||||
}).lanes();
|
||||
expect(lanesData.metadata.turnLanesForward)
|
||||
expect(lanesData.metadata.turnLanes.forward)
|
||||
.to.deep.equal([
|
||||
['slight_left', 'reverse', 'left'],
|
||||
['slight_left', 'left', 'through'],
|
||||
['through']
|
||||
]);
|
||||
expect(lanesData.metadata.turnLanesBackward)
|
||||
expect(lanesData.metadata.turnLanes.backward)
|
||||
.to.deep.equal([
|
||||
['none'],
|
||||
['through', 'left']
|
||||
]);
|
||||
expect(lanesData.lanes.map(function(l) { return l.turnLane; }))
|
||||
.to.deep.equal([
|
||||
['slight_left', 'reverse', 'left'],
|
||||
['slight_left', 'left', 'through'],
|
||||
['through'],
|
||||
['none'],
|
||||
['through', 'left']
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns unknown for every invalid value in turn:lanes', function() {
|
||||
@@ -1116,7 +1099,7 @@ describe('iD.Way', function() {
|
||||
'turn:lanes': '||straight;NO_LEFT',
|
||||
}
|
||||
}).lanes().metadata;
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([
|
||||
['none'], ['none'], ['unknown', 'unknown']
|
||||
]);
|
||||
@@ -1133,17 +1116,17 @@ describe('iD.Way', function() {
|
||||
'turn:lanes:backward': 'none|through|though;slight_right',
|
||||
}
|
||||
}).lanes().metadata;
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.deep.equal([
|
||||
['unknown']
|
||||
]);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.deep.equal([
|
||||
['none'], ['through'], ['unknown', 'slight_right']
|
||||
]);
|
||||
});
|
||||
|
||||
it('fills with [\'unknown\'] when given turn:lanes are less than lanes count', function() {
|
||||
it.skip('fills with [\'unknown\'] when given turn:lanes are less than lanes count', function() {
|
||||
var metadata = iD.Way({
|
||||
tags: {
|
||||
highway: 'tertiary',
|
||||
@@ -1153,13 +1136,13 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([
|
||||
['slight_left'], ['none'], ['unknown'], ['unknown'], ['unknown']
|
||||
['slight_left'], ['none']
|
||||
]);
|
||||
});
|
||||
|
||||
it('fills with [\'unknown\'] when given turn:lanes:forward are less than lanes forward count', function() {
|
||||
it.skip('fills with [\'unknown\'] when given turn:lanes:forward are less than lanes forward count', function() {
|
||||
var metadata = iD.Way({
|
||||
tags: {
|
||||
highway: 'tertiary',
|
||||
@@ -1171,17 +1154,17 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.deep.equal([
|
||||
['slight_left'], ['unknown'], ['unknown']
|
||||
]);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.deep.equal([
|
||||
['through'], ['unknown']
|
||||
]);
|
||||
});
|
||||
|
||||
it('clips when turn lane information is more than lane count', function() {
|
||||
it.skip('clips when turn lane information is more than lane count', function() {
|
||||
var metadata = iD.Way({
|
||||
tags: {
|
||||
highway: 'tertiary',
|
||||
@@ -1206,15 +1189,15 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.equal(undefined);
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.equal(undefined);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.equal(undefined);
|
||||
});
|
||||
|
||||
it('turnLanesForward and turnLanesBackward are both undefined when both are not provided', function() {
|
||||
it('turnLanes.forward and turnLanes.backward are both undefined when both are not provided', function() {
|
||||
var metadata = iD.Way({
|
||||
tags: {
|
||||
highway: 'tertiary',
|
||||
@@ -1224,11 +1207,11 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([['through'], ['through', 'slight_right']]);
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.equal(undefined);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.equal(undefined);
|
||||
});
|
||||
|
||||
@@ -1244,12 +1227,11 @@ describe('iD.Way', function() {
|
||||
'turn:lanes:backward': 'slight_right',
|
||||
'turn:lanes:forward': 'slight_left||',
|
||||
}
|
||||
}).lanes().lanes;
|
||||
var turnLanes = lanes.map(function(l) { return l.turnLane; });
|
||||
expect(turnLanes).to.deep.equal([
|
||||
['slight_left'], ['none'], ['none'], null, ['slight_right']
|
||||
]);
|
||||
|
||||
}).lanes();
|
||||
expect(lanes.metadata.turnLanes.backward)
|
||||
.to.deep.equal([['slight_right']]);
|
||||
expect(lanes.metadata.turnLanes.forward)
|
||||
.to.deep.equal([['slight_left'], ['none'], ['none']]);
|
||||
});
|
||||
|
||||
it('parses turnLane correctly when lanes:both_ways=1 & lanes:forward < lanes:backward', function() {
|
||||
@@ -1264,13 +1246,11 @@ describe('iD.Way', function() {
|
||||
'turn:lanes:forward': 'through',
|
||||
'turn:lanes:backward': 'slight_left||',
|
||||
}
|
||||
}).lanes().lanes;
|
||||
|
||||
var turnLanes = lanes.map(function(l) { return l.turnLane; });
|
||||
expect(turnLanes).to.deep.equal([
|
||||
['through'], null, ['slight_left'], ['none'], ['none']
|
||||
]);
|
||||
|
||||
}).lanes();
|
||||
expect(lanes.metadata.turnLanes.forward)
|
||||
.to.deep.equal([['through']]);
|
||||
expect(lanes.metadata.turnLanes.backward)
|
||||
.to.deep.equal([['slight_left'], ['none'], ['none']]);
|
||||
});
|
||||
|
||||
it('parses correctly when turn:lanes= ||x', function() {
|
||||
@@ -1283,7 +1263,7 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([['none'], ['none'], ['through', 'slight_right']]);
|
||||
});
|
||||
|
||||
@@ -1296,8 +1276,8 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanes)
|
||||
.to.deep.equal([['none'], ['through'], ['none'], ['unknown'], ['unknown']]);
|
||||
expect(metadata.turnLanes.unspecified)
|
||||
.to.deep.equal([['none'], ['through'], ['none']]);
|
||||
});
|
||||
|
||||
it('parses correctly when turn:lanes:forward= ||x', function() {
|
||||
@@ -1313,9 +1293,9 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.deep.equal([['none'], ['none'], ['through', 'slight_right']]);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.deep.equal([['none']]);
|
||||
});
|
||||
|
||||
@@ -1332,13 +1312,13 @@ describe('iD.Way', function() {
|
||||
}
|
||||
}).lanes().metadata;
|
||||
|
||||
expect(metadata.turnLanesForward)
|
||||
expect(metadata.turnLanes.forward)
|
||||
.to.deep.equal([['slight_left'], ['none'], ['none']]);
|
||||
expect(metadata.turnLanesBackward)
|
||||
expect(metadata.turnLanes.backward)
|
||||
.to.deep.equal([['none'], ['none']]);
|
||||
});
|
||||
|
||||
it('fills turnLane correctly in lanes', function() {
|
||||
it.skip('fills turnLane correctly in lanes', function() {
|
||||
var lanes = iD.Way({
|
||||
tags: {
|
||||
highway: 'tertiary',
|
||||
@@ -1355,7 +1335,6 @@ describe('iD.Way', function() {
|
||||
['slight_left'], ['none'], ['none'], ['none'], ['slight_right']
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('maxspeed', function() {
|
||||
@@ -1467,7 +1446,7 @@ describe('iD.Way', function() {
|
||||
lanes: 5,
|
||||
'maxspeed:lanes': '30|40|40|40|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
}).lanes().metadata.maxspeedLanes.unspecified;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
30, 40, 40, 40, 40
|
||||
]);
|
||||
@@ -1485,10 +1464,10 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes:backward': '30'
|
||||
}
|
||||
}).lanes().metadata;
|
||||
expect(metadata.maxspeedLanesForward).to.deep.equal([
|
||||
expect(metadata.maxspeedLanes.forward).to.deep.equal([
|
||||
'none', 40, 40, 40
|
||||
]);
|
||||
expect(metadata.maxspeedLanesBackward).to.deep.equal([
|
||||
expect(metadata.maxspeedLanes.backward).to.deep.equal([
|
||||
'none'
|
||||
]);
|
||||
});
|
||||
@@ -1502,7 +1481,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|||40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
30, 'none', 'none', 'none'
|
||||
]);
|
||||
});
|
||||
@@ -1516,7 +1495,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|||'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
30, 'none', 'none', 'none'
|
||||
]);
|
||||
});
|
||||
@@ -1530,7 +1509,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|40|40|40|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
30, 'none', 'none', 'none', 'none'
|
||||
]);
|
||||
maxspeedLanes = iD.Way({
|
||||
@@ -1541,7 +1520,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|40|40|40|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
30, 40, 40, 40, 40
|
||||
]);
|
||||
maxspeedLanes = iD.Way({
|
||||
@@ -1552,7 +1531,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|40|40|40|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
'none', 40, 40, 40, 40
|
||||
]);
|
||||
});
|
||||
@@ -1566,7 +1545,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|40|fourty|40|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
'none', 40, 'unknown', 40, 40
|
||||
]);
|
||||
maxspeedLanes = iD.Way({
|
||||
@@ -1577,12 +1556,12 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '30|40|fourty|40|random'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
'none', 40, 'unknown', 40, 'unknown'
|
||||
]);
|
||||
});
|
||||
|
||||
it('should return \'unknown\' when maxspeed:lanes length is less than lane count', function() {
|
||||
it.skip('should return \'unknown\' when maxspeed:lanes length is less than lane count', function() {
|
||||
var maxspeedLanes = iD.Way({
|
||||
tags: {
|
||||
highway: 'primary',
|
||||
@@ -1591,12 +1570,12 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '40|60|60'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
'none', 60, 60, 'unknown'
|
||||
]);
|
||||
});
|
||||
|
||||
it('should clip if maxspeed:lanes length is more than lane count', function() {
|
||||
it.skip('should clip if maxspeed:lanes length is more than lane count', function() {
|
||||
var maxspeedLanes = iD.Way({
|
||||
tags: {
|
||||
highway: 'primary',
|
||||
@@ -1605,7 +1584,7 @@ describe('iD.Way', function() {
|
||||
'maxspeed:lanes': '40|60|60|60|40'
|
||||
}
|
||||
}).lanes().metadata.maxspeedLanes;
|
||||
expect(maxspeedLanes).to.deep.equal([
|
||||
expect(maxspeedLanes.unspecified).to.deep.equal([
|
||||
'none', 60, 60, 60
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user