Skip to content
Snippets Groups Projects
Commit 843ffa16 authored by Jaime Arias's avatar Jaime Arias
Browse files

style: apply clang-format

parent 5ae13801
No related branches found
No related tags found
No related merge requests found
Pipeline #8736 passed with stages
in 8 minutes and 36 seconds
......@@ -22,7 +22,9 @@ bool isNumeric(std::string const &str) {
}
// Fonction pour obtenir le temps actuel en secondes
double getTime() { return (double)clock() / (double)CLOCKS_PER_SEC; }
double getTime() {
return (double)clock() / (double)CLOCKS_PER_SEC;
}
// Fonction pour afficher l'aide
void printHelp() {
......@@ -73,7 +75,7 @@ int main(int argc, char *argv[]) {
std::string option = std::string(argv[1]);
if (!option.compare("--input-file")) {
int pp = std::string(argv[2]).find(".dot"); // position du point
int pp = std::string(argv[2]).find(".dot"); // position du point
nom = std::string(argv[2]).substr(0, pp);
g = new Graph(argv[2]);
} else {
......@@ -149,7 +151,7 @@ int main(int argc, char *argv[]) {
// Charge constraints Matrix with paths from regex and generate minPaths
for (int i = 0; i < generate_paths.size(); i++) {
int pos = -1; // position de _ pour copier transition
int pos = -1; // position de _ pour copier transition
for (int j = 0; j < generate_paths[i].length(); j++) {
if (generate_paths[i][j] == '_') {
label.clear();
......
......@@ -69,7 +69,7 @@ T GetRandomElement(const std::set<T> &elements) {
return *std::next(elements.begin(), random(elements.size()));
}
Graph::Graph(){};
Graph::Graph() {};
Graph::Graph(Node *n) : initial_node_(n) {}
......
#include "graph.h"
#include <algorithm>
#include <catch2/catch_test_macros.hpp>
#include "graph.h"
#include "node.h"
#include <algorithm>
SCENARIO("a graph has an initial node") {
GIVEN("an empty graph") {
Graph *g = new Graph();
WHEN("the initial node is queried") {
THEN("it returns null") { REQUIRE(g->initial_node() == nullptr); }
THEN("it returns null") {
REQUIRE(g->initial_node() == nullptr);
}
}
}
......
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include "path_generator.h"
#include <iostream>
SCENARIO("a regex has paths") {
GIVEN("a regex") {
......
#include <catch2/catch_test_macros.hpp>
#include "node.h"
#include <catch2/catch_test_macros.hpp>
SCENARIO("a node has an id") {
GIVEN("a node initialized with id 1") {
Node *n = new Node(1);
WHEN("the id is queried") {
THEN("it returns 1") { REQUIRE(n->id() == 1); }
THEN("it returns 1") {
REQUIRE(n->id() == 1);
}
}
WHEN("the id is modified by 2") {
n->set_id(2);
THEN("it returns 2") { REQUIRE(n->id() == 2); }
THEN("it returns 2") {
REQUIRE(n->id() == 2);
}
}
}
}
......@@ -20,12 +24,16 @@ SCENARIO("a node has a name") {
GIVEN("a node initialized with name s0") {
Node *n = new Node(0, "s0");
WHEN("the name is queried") {
THEN("it returns s0") { REQUIRE(n->name() == "s0"); }
THEN("it returns s0") {
REQUIRE(n->name() == "s0");
}
}
WHEN("the name is modified by s1") {
n->set_name("s1");
THEN("it returns s1") { REQUIRE(n->name() == "s1"); }
THEN("it returns s1") {
REQUIRE(n->name() == "s1");
}
}
}
}
......
#include "regex_generator.h"
#include <algorithm>
#include <catch2/catch_test_macros.hpp>
#include "graph.h"
#include "regex_generator.h"
#include <algorithm>
template <typename T> bool contains(const std::vector<T> &vec, const T &value) {
template <typename T>
bool contains(const std::vector<T> &vec, const T &value) {
return std::find(vec.begin(), vec.end(), value) != vec.end();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment