Hoa central
Public Member Functions | Protected Member Functions | List of all members
Hoa\Json\Test\Unit\Soundness Class Reference
Inheritance diagram for Hoa\Json\Test\Unit\Soundness:

Public Member Functions

 case_exaustive_json ()
 
 case_coverage_json ()
 
 case_uniform_random_json ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Protected Member Functions

 with_json ($sampler, $compiler=null)
 
 getJSONCompiler ()
 
 getRegexSampler ()
 

Detailed Description

Class .

Check soundness of the LL(k) compiler.

Definition at line 54 of file Soundness.php.

Member Function Documentation

Hoa\Json\Test\Unit\Soundness::case_coverage_json ( )

Definition at line 67 of file Soundness.php.

68  {
69  $this->with_json(
70  new LUT\Llk\Sampler\Coverage(
71  $this->getJSONCompiler(),
72  $this->getRegexSampler()
73  )
74  );
75  }
with_json($sampler, $compiler=null)
Definition: Soundness.php:99

Here is the call graph for this function:

Hoa\Json\Test\Unit\Soundness::case_exaustive_json ( )

Definition at line 56 of file Soundness.php.

57  {
58  $this->with_json(
59  new LUT\Llk\Sampler\BoundedExhaustive(
60  $this->getJSONCompiler(),
61  $this->getRegexSampler(),
62  12
63  )
64  );
65  }
with_json($sampler, $compiler=null)
Definition: Soundness.php:99

Here is the call graph for this function:

Hoa\Json\Test\Unit\Soundness::case_uniform_random_json ( )

Definition at line 77 of file Soundness.php.

78  {
79  $this
80  ->given(
81  $sampler = new LUT\Llk\Sampler\Uniform(
82  $this->getJSONCompiler(),
83  $this->getRegexSampler(),
84  5
85  )
86  )
87  ->with_json(
88  new Iterator\Limit(
89  new Iterator\CallbackGenerator(function () use ($sampler) {
90  return $sampler->uniform();
91  }),
92  0,
93  1000
94  ),
95  $sampler->getCompiler()
96  );
97  }

Here is the call graph for this function:

Hoa\Json\Test\Unit\Soundness::getJSONCompiler ( )
protected

Definition at line 123 of file Soundness.php.

124  {
125  return LUT\Llk::load(
126  new File\Read('hoa://Library/Json/Grammar.pp')
127  );
128  }

Here is the caller graph for this function:

Hoa\Json\Test\Unit\Soundness::getRegexSampler ( )
protected

Definition at line 130 of file Soundness.php.

131  {
132  return new Regex\Visitor\Isotropic(new Math\Sampler\Random());
133  }

Here is the caller graph for this function:

Hoa\Json\Test\Unit\Soundness::with_json (   $sampler,
  $compiler = null 
)
protected

Definition at line 99 of file Soundness.php.

100  {
101  if (null === $compiler) {
102  $compiler = $sampler->getCompiler();
103  }
104 
105  $this
106  ->when(function () use ($compiler, $sampler) {
107  foreach ($sampler as $datum) {
108  $this
109  ->given(json_decode($datum))
110  ->when($error = json_last_error())
111  ->then
112  ->integer($error)
113  ->isEqualTo(JSON_ERROR_NONE)
114 
115  ->when($result = $compiler->parse($datum, null, false))
116  ->then
117  ->boolean($result)
118  ->isTrue();
119  }
120  });
121  }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: