________________________________________________________________________

This file is part of Logtalk <http://logtalk.org/>  
Copyright 1998-2016 Paulo Moura <pmoura@logtalk.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% start by loading the sample properties used to use QuickCheck interactively
% at the top-level interpreter:

| ?- logtalk_load(quick_check(loader)).
...


% check that reversing a list twice gives back the same list:

| ?- lgtunit::quick_check(reverse_2_twice_prop(+list)).
% 100 random tests passed
yes


% check the same_length_2_prop/1 property by running the default number of
% random tests:

| ?- lgtunit::quick_check(same_length_2_prop(+list)).
% 100 random tests passed
yes


% check the same_length_3_prop/1 property by running 25 random tests:

| ?- lgtunit::quick_check(same_length_3_prop(+list), [n(25)]).
% 25 random tests passed
yes


% try a broken property, broken_nth1_3_prop/1, to check returning of a
% counter-example that falsifies the property:

| ?- lgtunit::quick_check(broken_nth1_3_prop(+list), [n(25)]).
*       quick check test failure:
*         broken_nth1_3_prop([157.39783108350045,-79])
no


% the alternative lgtunit::quick_check/3 predicate returns results in
% reified form:

| ?- lgtunit::quick_check(same_length_2_prop(+list), Result, []).
Result = passed.
yes

?- lgtunit::quick_check(broken_nth1_3_prop(+list), Result, [n(250)]).
Result = failed(broken_nth1_3_prop([-580.5691640744163, 19, 'nUU!{4WKMv]fCtX*cOyApd', 457])).
yes
