#include "TestPolygonCalculus.h"
#include "PolygonCalculus.h"
#include <QPolygonF>
#include <QPointF>

namespace TestPolygonCalculus {
    void test()
    {
        using namespace PolygonCalculus;

        QPolygonF polygon;
        polygon << QPointF(0, 0) << QPointF(1, 0) << QPointF(1, 1) << QPointF(0, 1);

        bool retVal = containsPath(polygon, QPointF(0.1, 0.1), QPointF(0.2, 0.1));
        qDebug("true %i", retVal);
        retVal = containsPath(polygon, QPointF(0.2, 0.1), QPointF(0.2, 0.1));
        qDebug("true %i", retVal);
        retVal = containsPath(polygon, QPointF(1, 0.1), QPointF(0.2, 0.1));
        qDebug("true %i", retVal);
        retVal = containsPath(polygon, QPointF(0.1, 0.1), QPointF(1, 0.1));
        qDebug("true %i", retVal);
        retVal = containsPath(polygon, QPointF(2, 0.1), QPointF(0.2, 0.1));
        qDebug("false %i", retVal);
        retVal = containsPath(polygon, QPointF(-2, 0.1), QPointF(0.2, 0.1));
        qDebug("false %i", retVal);
        polygon << QPointF(0.5, 0.6) << QPointF(0.5, 0.4);
        retVal = containsPath(polygon, QPointF(0.2, 0.1), QPointF(0.2, 0.9));
        qDebug("false %i", retVal);
        retVal = containsPath(polygon, QPointF(0.1, 0.05), QPointF(0.51, 0.6));
        qDebug("false %i", retVal);
    }

}
