#include <BRepFill_CompatibleWires.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Standard_Failure.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Ax2.hxx>
#include <gp_Circ.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <iostream>

int main()
{
  try {
    const TopoDS_Wire open = BRepBuilderAPI_MakeWire(
      BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(10, 0, 0)).Edge()).Wire();
    const gp_Circ circle(gp_Ax2(gp_Pnt(0, 0, 5), gp_Dir(0, 0, 1)), 3.0);
    const TopoDS_Wire closed = BRepBuilderAPI_MakeWire(
      BRepBuilderAPI_MakeEdge(circle).Edge()).Wire();
    TopTools_SequenceOfShape sections;
    sections.Append(open);
    sections.Append(closed);
    BRepFill_CompatibleWires compatible(sections);
    compatible.Perform();
    const bool expected = !compatible.IsDone()
      && compatible.GetStatus() == BRepFill_ThruSectionErrorStatus_NotSameTopology;
    std::cout << std::boolalpha << "IsDone=" << compatible.IsDone()
      << "; NotSameTopology=" << expected << '\n';
    return expected ? 0 : 1;
  } catch (const Standard_Failure& failure) {
    std::cerr << failure.GetMessageString() << '\n';
    return 2;
  }
}
