#!/bin/bash
set -e

# The purpose of this test is to make sure we're preventing an error when the Network Alg tries to 
# calculate a heading at a road vertex with a relation as the network edge input. It should skip it 
# unless the edge is a way. The actual output of this test isn't all that important as the Network 
# Alg is tested thoroughly elsewhere.
#
# Note: The missing element to merge warning generated by this test should be looked into at some 
# point. Not critical right now.

INPUT_DIR=test-files/cmd/slow/NetworkConflateCmdRelationEdgeTest
OUTPUT_DIR=test-output/cmd/slow/NetworkConflateCmdRelationEdgeTest
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR

hoot conflate --warn -C ReferenceConflation.conf -C NetworkAlgorithm.conf -C Testing.conf \
  -D uuid.helper.repeatable=true -D match.creators="NetworkMatchCreator" \
  -D merger.creators="NetworkMergerCreator" \
  $INPUT_DIR/input1.osm $INPUT_DIR/input2.osm $OUTPUT_DIR/out.osm
hoot diff -C Testing.conf $INPUT_DIR/out.osm $OUTPUT_DIR/out.osm || diff $INPUT_DIR/out.osm $OUTPUT_DIR/out.osm
