You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our testing approach for Prolog predicates relies on the smartystreets/goconvey library. This method uses a data-driven strategy where test data encapsulates use cases, including the program to execute, the query, the desired result, and any errors. Though effective and functional, this approach is becoming increasingly cumbersome and code-intensive when writting tests for new predicates.
Proposal for Refactoring
The proposed change involves shifting towards pure Prolog testing. In this new framework, smartystreets/goconvey would be primarily used for setting up test scenarios. This setup includes initializing the Prolog interpreter, declaring the predicates under test, and establishing the relevant context. However, the core of the testing would be conducted entirely in Prolog.
The benefits is a reduced complexity: by leveraging Prolog for assertions, we can simplify the testing process, making it more intuitive and especially maintainable.
Approach
To facilitate this transition, we would need to integrate a basic test (test/1, test/2) predicate, implemented in Go for expressing test cases in Prolog. This predicate would be pivotal in writing concise and clear test cases within the Prolog environment.
Example:
The following use case data for testing the bech32_address/2 predicate:
Deprecated. A different strategy has been implemented by #579, opting for a test methodology approach based on Gherkin - a textual, behavior-oriented approach that is human oriented, simple to implement, highly extensible.
Overview
Currently, our testing approach for Prolog predicates relies on the smartystreets/goconvey library. This method uses a data-driven strategy where test data encapsulates use cases, including the program to execute, the query, the desired result, and any errors. Though effective and functional, this approach is becoming increasingly cumbersome and code-intensive when writting tests for new predicates.
Proposal for Refactoring
The proposed change involves shifting towards pure
Prolog
testing. In this new framework, smartystreets/goconvey would be primarily used for setting up test scenarios. This setup includes initializing theProlog
interpreter, declaring the predicates under test, and establishing the relevant context. However, the core of the testing would be conducted entirely in Prolog.The benefits is a reduced complexity: by leveraging
Prolog
for assertions, we can simplify the testing process, making it more intuitive and especially maintainable.Approach
To facilitate this transition, we would need to integrate a basic
test
(test/1
,test/2
) predicate, implemented in Go for expressing test cases in Prolog. This predicate would be pivotal in writing concise and clear test cases within the Prolog environment.Example:
The following use case data for testing the
bech32_address/2
predicate:could be replaced with the following prolog unit test:
The text was updated successfully, but these errors were encountered: