@@ -62,7 +62,7 @@ struct GenerationProbability
6262{
6363 // / @returns an unsigned integer in the range [1, @param _n] chosen
6464 // / uniformly at random.
65- static size_t distributionOneToN (size_t _n, std::shared_ptr<RandomEngine> _rand)
65+ static size_t distributionOneToN (size_t _n, std::shared_ptr<RandomEngine> const & _rand)
6666 {
6767 return Distribution (1 , _n)(*_rand);
6868 }
@@ -88,7 +88,7 @@ struct GeneratorVisitor
8888
8989struct GeneratorBase
9090{
91- GeneratorBase (std::shared_ptr<SolidityGenerator> _mutator);
91+ explicit GeneratorBase (std::shared_ptr<SolidityGenerator> _mutator);
9292 template <typename T>
9393 std::shared_ptr<T> generator ()
9494 {
@@ -141,7 +141,7 @@ struct GeneratorBase
141141class TestCaseGenerator : public GeneratorBase
142142{
143143public:
144- TestCaseGenerator (std::shared_ptr<SolidityGenerator> _mutator):
144+ explicit TestCaseGenerator (std::shared_ptr<SolidityGenerator> _mutator):
145145 GeneratorBase(std::move(_mutator)),
146146 m_numSourceUnits(0 )
147147 {}
@@ -152,7 +152,11 @@ class TestCaseGenerator: public GeneratorBase
152152 return " Test case generator" ;
153153 }
154154private:
155- std::string path () const
155+ // / Returns a new source path name that is formed by concatenating
156+ // / a static prefix @name m_sourceUnitNamePrefix, a monotonically
157+ // / increasing counter starting from 0 and the postfix (extension)
158+ // / ".sol".
159+ [[nodiscard]] std::string path () const
156160 {
157161 return m_sourceUnitNamePrefix + std::to_string (m_numSourceUnits) + " .sol" ;
158162 }
@@ -167,7 +171,7 @@ class TestCaseGenerator: public GeneratorBase
167171class SourceUnitGenerator : public GeneratorBase
168172{
169173public:
170- SourceUnitGenerator (std::shared_ptr<SolidityGenerator> _mutator):
174+ explicit SourceUnitGenerator (std::shared_ptr<SolidityGenerator> _mutator):
171175 GeneratorBase(std::move(_mutator))
172176 {}
173177 void setup () override ;
@@ -178,7 +182,7 @@ class SourceUnitGenerator: public GeneratorBase
178182class PragmaGenerator : public GeneratorBase
179183{
180184public:
181- PragmaGenerator (std::shared_ptr<SolidityGenerator> _mutator):
185+ explicit PragmaGenerator (std::shared_ptr<SolidityGenerator> _mutator):
182186 GeneratorBase(std::move(_mutator))
183187 {}
184188 std::string visit () override ;
@@ -190,8 +194,6 @@ class SolidityGenerator: public std::enable_shared_from_this<SolidityGenerator>
190194public:
191195 explicit SolidityGenerator (unsigned _seed);
192196
193- // / Returns a multi-source test case.
194- std::string visit ();
195197 // / Returns the generator of type @param T.
196198 template <typename T>
197199 std::shared_ptr<T> generator ();
0 commit comments