Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 363c6c182d7c2f47e784088b7961f77458912912 authored by Max Göttlicher on 09 August 2022, 11:52:28 UTC, committed by Max Göttlicher on 09 August 2022, 11:52:28 UTC
made doc target optinal and added endpoint method
1 parent 655a80d
  • Files
  • Changes
  • cf68df9
  • /
  • test
  • /
  • testBoostIntegration.cpp
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:363c6c182d7c2f47e784088b7961f77458912912
directory badge
swh:1:dir:174fcd1df5c7c4188233491bb7b19032932fd706
content badge
swh:1:cnt:9ad40edecbce22ad873bf67b9c6c7a75ebe59173

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
testBoostIntegration.cpp
//
// Created by max on 08.08.22.
//

#include <boost/test/unit_test.hpp>
#include <boost/graph/graph_concepts.hpp>
#include "setgraph/boost_adapter.hpp"

using setgraph::SetGraph, setgraph::EdgeDirection, setgraph::Empty;

template<class... T>
struct PrintType;

void _bidirectional_concepts() {
    using Graph = SetGraph<setgraph::Empty, setgraph::Empty, setgraph::EdgeDirection::Bidirectional>;
    boost::GraphConcept<Graph> _g;
    boost::IncidenceGraphConcept<Graph> _ig;
    boost::BidirectionalGraphConcept<Graph> _bg;
    boost::AdjacencyGraphConcept<Graph> _ag;
    boost::VertexListGraphConcept<Graph> _vlg;
    boost::EdgeListGraphConcept<Graph> _elg;
    boost::AdjacencyMatrixConcept<Graph> _am;
    boost::MutableGraphConcept<Graph> _mg;
}

void _undirected_concepts() {
    using Graph = SetGraph<setgraph::Empty, setgraph::Empty, setgraph::EdgeDirection::Undirected>;
    boost::GraphConcept<Graph> _g;
    boost::IncidenceGraphConcept<Graph> _ig;
    boost::BidirectionalGraphConcept<Graph> _bg;
    boost::AdjacencyGraphConcept<Graph> _ag;
    boost::VertexListGraphConcept<Graph> _vlg;
    boost::EdgeListGraphConcept<Graph> _elg;
    boost::AdjacencyMatrixConcept<Graph> _am;
    boost::MutableGraphConcept<Graph> _mg;
}

void _directed_concepts() {
    using Graph = SetGraph<setgraph::Empty, setgraph::Empty, setgraph::EdgeDirection::Directed>;
    boost::GraphConcept<Graph> _g;
    boost::IncidenceGraphConcept<Graph> _ig;
    boost::AdjacencyGraphConcept<Graph> _ag;
    boost::VertexListGraphConcept<Graph> _vlg;
    boost::EdgeListGraphConcept<Graph> _elg;
    boost::AdjacencyMatrixConcept<Graph> _am;
    boost::MutableGraphConcept<Graph> _mg;
}

BOOST_AUTO_TEST_CASE(testStandardFunctions) {
    using Graph = SetGraph<Empty, Empty, EdgeDirection::Undirected>;
    Graph graph;
    auto a = add_vertex(graph);
    auto b = add_vertex(graph);
    auto c = add_vertex(graph);
    auto d = add_vertex(graph);
    auto e = add_vertex(graph);

    add_edge(a, b, graph);
    add_edge(a, c, graph);
    add_edge(a, d, graph);
    add_edge(d, e, graph);
    add_edge(b, e, graph);
    add_edge(c, b, graph);

    setgraph::set<Graph::vertex_descriptor> all_vertices;
    auto vertex_range = vertices(graph);
    for (auto it = vertex_range.first; it != vertex_range.second; ++it) {
        all_vertices.insert(*it);
    }
    BOOST_TEST(all_vertices.size() == 5);
    BOOST_TEST(all_vertices.contains(a));
    BOOST_TEST(all_vertices.contains(b));
    BOOST_TEST(all_vertices.contains(c));
    BOOST_TEST(all_vertices.contains(d));
    BOOST_TEST(all_vertices.contains(e));

    BOOST_TEST(graph.edge(a, b).has_value());
    BOOST_TEST(graph.edge(a, c).has_value());
    BOOST_TEST(graph.edge(a, d).has_value());
    BOOST_TEST(graph.edge(d, e).has_value());
    BOOST_TEST(graph.edge(b, c).has_value());

    BOOST_TEST(graph.numVertices() == 5);
    BOOST_TEST(num_vertices(graph) == 5);
    BOOST_TEST(graph.numEdges() == 6);
    BOOST_TEST(num_edges(graph) == 6);

    for (auto v: graph.vertices()) {
        BOOST_TEST(degree(v, graph) == graph.degree(v));
        BOOST_TEST(in_degree(v, graph) == graph.inDegree(v));
    }

    for (auto e: graph.edges()) {
        BOOST_TEST(source(e, graph) == graph.source(e));
        BOOST_TEST(target(e, graph) == graph.target(e));
    }
}
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API