Skip to content

Commit

Permalink
✅ Cover GlobalCZOp with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ystade committed Mar 3, 2025
1 parent ba95268 commit 7a24124
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/mqt-core/na/operations/LoadOp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
#include "na/entities/Location.hpp"
#include "na/operations/ShuttlingOp.hpp"

#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

namespace na {

class LoadOp : public ShuttlingOp {
class LoadOp final : public ShuttlingOp {
protected:
std::optional<std::vector<Location>> targetLocations = std::nullopt;

Expand Down
2 changes: 1 addition & 1 deletion include/mqt-core/na/operations/MoveOp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace na {

class MoveOp : public ShuttlingOp {
class MoveOp final : public ShuttlingOp {
protected:
std::vector<Location> targetLocations;

Expand Down
2 changes: 1 addition & 1 deletion include/mqt-core/na/operations/StoreOp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace na {

class StoreOp : public ShuttlingOp {
class StoreOp final : public ShuttlingOp {
protected:
std::optional<std::vector<Location>> targetLocations = std::nullopt;

Expand Down
5 changes: 4 additions & 1 deletion test/na/test_nacomputation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ir/operations/OpType.hpp"
#include "na/NAComputation.hpp"
#include "na/NAUtils.hpp"
#include "na/operations/GlobalCZOp.hpp"
#include "na/operations/GlobalRYOp.hpp"
#include "na/operations/LoadOp.hpp"
#include "na/operations/LocalRZOp.hpp"
Expand Down Expand Up @@ -40,6 +41,7 @@ TEST(NAComputation, General) {
std::vector{Location{4, 1}, Location{5, 1}});
qc.emplaceBack<StoreOp>(std::vector{atom0, atom1},
std::vector{Location{4, 0}, Location{5, 0}});
qc.emplaceBack(GlobalCZOp(globalZone));
std::stringstream ss;
ss << qc;
EXPECT_EQ(ss.str(), "atom (0.000, 0.000) atom0\n"
Expand All @@ -58,7 +60,8 @@ TEST(NAComputation, General) {
"@+ store [\n"
" (4.000, 0.000) atom0\n"
" (5.000, 0.000) atom1\n"
"]\n");
"]\n"
"@+ cz global\n");
}

TEST(NAComputation, EmptyPrint) {
Expand Down

0 comments on commit 7a24124

Please sign in to comment.