Thanks to everyone who attended my April 2015 Iowa Ruby Brigade talk. These are my notes, source code is here.
##How to call C from Ruby
Easymode, call your C binary from the shell in Ruby
Call your Ruby code fom C
How to write Ruby extensions in C
#Example C extension, fib-example
MyFib.c
extconf.rb
myfibDriver.rb
Compiling and running the C extension
Compiling CRuby with code coverage
(optional) uncomment #option nodynamic in ruby/ext/Setup
Pretty printing coverage for C
Raw code coverage in Ruby
Simplecov for pretty-print coverage in Ruby
How to call the z3 SMT solver with SMT-LIB2 syntax
An example SMT-LIB2 program
Key concept. Constants in SMT-LIB are functions which take no arguments.
IF THEN ELSE in Ruby
IF THEN ELSE in SMT-LIB
Printing in SMT-LIB
Simplifying expressions in SMT-LIB
Project Euler problem 4, find the largest palindrome made from the product of two 3-digit numbers.
SMT-LIB Tutorial with Z3
#Putting it all together to test Fizz-Buzz-Jaberwocky
#Synopsys.
Test before you code.
Run your tests with code coverage.
Use Z3 as a bench calculator to help fill testing gaps.
Build a CRuby binary with code coverage to see the low level hot spots in your app.
Other links:
SMT-LIB language
Z3 SMT Solver
Concolic Testing
My reading picks for this summer:
Conceptual Mathematics: A First Introduction to Categories
Real World OCaml
Your Code as a Crime Scene