#!/bin/sh
# autopkgtest check: Build and run a program against ign-common, to verify that the
# headers and pkg-config file are installed correctly
# (C) 2012 Jose Luis Rivero
# Author: Jose Luis Rivero <jrivero@osrfoundation.org>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > igntest.c

#include <iostream>
#include <ignition/common/Base64.hh>

int main(int argc, char **argv)
{
    std::string str = "123abc";
    std::string result;
    ignition::common::Base64::Encode(str.c_str(), str.size(), result);

    return 0;
}
EOF

g++ -o igntest igntest.c `pkg-config --cflags --libs ignition-common3`
echo "build: OK"
[ -x igntest ]
./igntest
echo "run: OK"
