# Copyright 2013 Samsung Information Systems America, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Author: Koushik Sen


cd jalangi_tmp 2>&1

if [ "$USE_NODE_COVER" == "true" ]
then
    export CMD='cover run '
    cp ../.coverignore .
    mv ../.coverage_data .
else
    export CMD='node '
fi

rm -rf .coverage_data

for i in jalangi_inputs*
do
    echo "***************** Running tests/$1.js on $i ********************"
    cp $i inputs.js
    $CMD ../$1.js
done

if [ "$USE_NODE_COVER" == "true" ]
then
    sleep 2
    cover combine
    cover report
    cover report html
    echo "test results ..."
    open cover_html/index.html
fi
