#ifndef CXXFOOZZ_INCLUDE_MUTATOR_HPP_ #define CXXFOOZZ_INCLUDE_MUTATOR_HPP_ #include "sequencegen.hpp" #include "statement.hpp" #include "type.hpp" #include "program-context.hpp" namespace cxxfoozz { class OperandMutator { public: explicit OperandMutator(const std::shared_ptr &context); Operand MutateOperand( const Operand &op, const std::shared_ptr &op_stmt_ctx, const TestCase &tc_ctx, const bpstd::optional &type_rq = bpstd::nullopt // required for cross-variant ); Operand MutateConstantOperand(const Operand &op); Operand MutateConstantOperand(const TypeWithModifier &type); Operand MutateRefOperand( const Operand &op, const std::shared_ptr &op_stmt_ctx, const TestCase &tc_ctx, const bpstd::optional &type_rq ); Operand MutateOperandCrossVariant( const Operand &op, const std::shared_ptr &op_stmt_ctx, const TestCase &tc_ctx, const bpstd::optional &type_rq ); private: const std::shared_ptr &context_; }; class StatementMutator { public: StatementMutator(std::shared_ptr cut, std::shared_ptr context); std::shared_ptr MutateStatement(const std::shared_ptr &stmt, const TestCase &tc_ctx); std::shared_ptr MutatePrimitiveAssignment(const std::shared_ptr &stmt, const TestCase &tc_ctx); std::shared_ptr MutateCall(const std::shared_ptr &stmt, const TestCase &tc_ctx); std::shared_ptr MutateSTLConstruction(const std::shared_ptr &stmt, const TestCase &tc_ctx); std::shared_ptr MutateArrayInit(const std::shared_ptr &stmt, const TestCase &tc_ctx); const std::shared_ptr &GetCut() const; const std::shared_ptr &GetContext() const; private: std::shared_ptr cut_; std::shared_ptr context_; }; class TestCaseMutator { public: TestCaseMutator(std::shared_ptr cut, std::shared_ptr context); TestCase MutateTestCase(const TestCase &tc, int maxHavoc); void InplaceMutationByInsertion(TestCase &tc); void InplaceMutationByUpdate(TestCase &tc); void InplaceMutationByCleanup(TestCase &tc); const std::shared_ptr &GetCut() const; const std::shared_ptr &GetContext() const; private: std::shared_ptr cut_; std::shared_ptr context_; }; } // namespace cxxfoozz #endif //CXXFOOZZ_INCLUDE_MUTATOR_HPP_