Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Deliver yesterday, code today, think tomorrow.


devel / Programming / Property Based Testing

SubjectAuthor
o Property Based TestingAnonUser

1
Property Based Testing

<2b1854a8e6d9359aa1c7a09af559c8d7$1@rocksolidbbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=681&group=rocksolid.programming#681

  copy link   Newsgroups: rocksolid.programming
Path: i2pn2.org!rocksolid3!.POSTED.localhost!not-for-mail
From: anonuser@retrobbs.rocksolidbbs.com.remove-2lo-this (AnonUser)
Newsgroups: rocksolid.programming
Subject: Property Based Testing
Date: Mon, 18 Nov 2019 12:28:58 +0000
Organization: RetroBBS
Message-ID: <2b1854a8e6d9359aa1c7a09af559c8d7$1@rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: rocksolidbbs.com; posting-host="localhost:127.0.0.1";
logging-data="15033"; mail-complaints-to="usenet@rocksolidbbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: rocksolid.programming
X-Comment-To: rocksolid.programming
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$UVIPP3GQVTWG/oyromg67.0GN70gVMwiN/P1iWbvTxUnq/18rXNjK
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
 by: AnonUser - Mon, 18 Nov 2019 12:28 UTC

To: rocksolid.programming
Title: Property Based Testing

While formal verification is the most reliable you can get, there also
exists
property based testing which comes very close to it and it's easier and
faster
to implement.

There's a paper on how the Haskell containers library was formally
verified in
Coq (a proof assistant) by converting the Haskell code to Coq using
hs-to-coq.
They verified that the containers library had _zero_ bugs in it and it is
likely due to them using property based tests for the library. I guess it
being
written in Haskell also has a huge part in it being bug free.

paper: https://dl.acm.org/citation.cfm?id=3236784
verified containers package:
https://hackage.haskell.org/package/containers-verified
talk for the paper: https://invidio.us/watch?v=9QL97E0cNk0

In short, property based testing means that you have a function and you
verify
that it has specific properties. The most popular example is a sort
function.

A sort function _must_ have the following properties:
* it may not change the length of the resulting list
* the resulting list must have each element the same amount of times pre
and
post sort
* sorting a list twice must equal sorting the list once
* each consecutive value in a list must be greater or equal to the previous
value (ascending)

These properties are in a way formal proofs of a sort function.

QuickCheck is such a library that makes property based testing really
easy. It
randomly generates input for your functions and finds the (minimal)
examples
where your function doesn't satisfy those properties. If you need more
encouragement that property based testing is awesome, then check out the
computerphile video on "Code Checking Automation" on Youtube. John Huges
helped
develop the Haskell language and also created QuickCheck.

video: https://invidio.us/watch?v=AfaNEebCDos

It is also possible to use property based testing on state machines to
ensure
that invalid states can not be reached.
--
Posted on RetroBBS

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor