Skip to content
Extraits de code Groupes Projets
Valider 328c8421 rédigé par Louis Navarre's avatar Louis Navarre
Parcourir les fichiers

Correct Python nb_nodes and sample NTF

For CI

CI file

Update CI

Correct output format for statement

Update CI
parent e40057dd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
# image: registry.forge.uclouvain.be/inl/containers/runner-python
stages: # List of stages for jobs, and their order of execution
- test
variables:
GOUTPUT: graph_test.bin
ROUTPUT: out_test.bin
test-job: # This job runs in the test stage.
stage: test
script:
- echo "Running unit tests..."
- python3 create_graph.py --ntf sample_ntf/small.ntf --output $GOUTPUT
- python3 sp.py -f $ROUTPUT $GOUTPUT
- python3 verify_output.py $ROUTPUT
only:
- main
artifacts:
paths:
- $GOUTPUT
- $ROUTPUT
Le mode du fichier est passé de 100644 à 100755
0 1 1
1 0 4
0 2 -1
2 1 9
\ No newline at end of file
sp.py 100644 → 100755
...@@ -104,7 +104,7 @@ def read_graph(filename): ...@@ -104,7 +104,7 @@ def read_graph(filename):
l1 = [from_node, to_node, cost] l1 = [from_node, to_node, cost]
links.append(l1) links.append(l1)
return links return links, nb_nodes
if __name__ == "__main__": if __name__ == "__main__":
...@@ -128,9 +128,14 @@ if __name__ == "__main__": ...@@ -128,9 +128,14 @@ if __name__ == "__main__":
# Exemple de message que vous pouvez ecrire si le mode verbose est actif. # Exemple de message que vous pouvez ecrire si le mode verbose est actif.
print(args, file=sys.stderr) print(args, file=sys.stderr)
graph = read_graph(args.input_file) graph, nb_nodes = read_graph(args.input_file)
if output_fd == sys.stdout or output_fd == sys.stderr:
print("Nombre de noeuds: " + str(nb_nodes))
else:
output_fd.write(nb_nodes.to_bytes(4, "big"))
for source in range(nb_nodes): for source in range(nb_nodes):
dist, path = bellman_ford(graph, source) dist, path = bellman_ford(graph, source, verbose)
# Ces messages ne sont pas des messages de debug. # Ces messages ne sont pas des messages de debug.
# Ils peuvent donc etre affiches (uniquement si la sortie choisie est stdout ou stderr) # Ils peuvent donc etre affiches (uniquement si la sortie choisie est stdout ou stderr)
...@@ -147,8 +152,8 @@ if __name__ == "__main__": ...@@ -147,8 +152,8 @@ if __name__ == "__main__":
else: else:
output_fd.write(source.to_bytes(4, "big")) output_fd.write(source.to_bytes(4, "big"))
d, n = get_max(dist, source) d, n = get_max(dist, source)
output_fd.write(d.to_bytes(4, "big", signed=True))
output_fd.write(n.to_bytes(4, "big")) output_fd.write(n.to_bytes(4, "big"))
output_fd.write(d.to_bytes(8, "big", signed=True))
r = get_path(n, path, source) r = get_path(n, path, source)
output_fd.write(len(r).to_bytes(4, "big", signed=True)) output_fd.write(len(r).to_bytes(4, "big", signed=True))
for j in range(len(r)): for j in range(len(r)):
......
Le mode du fichier est passé de 100644 à 100755
Le mode du fichier est passé de 100644 à 100755
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter