Examples in manuals – how to verify (test) them

I’ve gotten some just comments as feedback for the examples in the Searduino Manuals. Searduino is a software to make it easy to program C/C++ for Arduino, a simulator for source level Arduino API, … and more.

Problem is the following: I’d written some examples to make it easy to get started with Searduino. After some weeks of updates to the code the examples were not correct anymore. What good is it to have examples if they don’t work? But on the other hand, it’s really a pain in the ¤/&% to have to update example code. We need a way to test example code in manuals and to automate the tests!

Copying/pasting code from a manual is not something that is not desired (error prune to say one problem). So how to find some middle ground here? Is there any software for this?

My temporary solution was to write all examples as C files and Makefiles and to write some scripts to

  • convert a C file to texinfo file (c2texi)
  • convert a Makefile file to texinfo file (makefile2texi)

and then include the generated texi files in the manual (written in Texinfo). Will probably do the same for GNU Xnee

There must be  a better way … or?

 

Advertisements

41 – an Adams prime number

During a lunch the other day we spoke about the number 41 (which happens to my age (actually today I am turning 41)) and that it is a prime number.

Rikard pointed out that 41 is not  Mersenne primes number, so it seemed to us that 41 is just another ‘boring’ prime. But then Greg pointed out that 41 is equal to 42-1. 42 is a really interesting number, since according to Douglas Adams (author of The Hitchhiker’s Guide to the Galaxy) 42 is the answer to….. (well, read the hitchhiker’s guide and you’ll find out). So 41 must be an interesting prime after all. So given the way we name some prime numbers Mersenne we should name all the prime numbers that can be written as 42-1 an Adams prime number.

Now we need to find if there are an infinite number of Adams prime numbers…..

Searduino 0.5 released

Implemented features:

Download:

Source code dist:

http://download.savannah.gnu.org/releases/searduino/src/searduino-0.50.tar.gz

Binary dist for GNU/Linux x86_64t

http://download.savannah.gnu.org/releases/searduino/bin/gnu-linux/searduino-bin-0.50-x86_64.tar.gz

Binary dist for GNU/Linux i686t

http://download.savannah.gnu.org/releases/searduino/bin/gnu-linux/searduino-bin-0.50-i686.tar.gz

Documentation:

http://download.savannah.gnu.org/releases/searduino/doc/searduino-docs-0.50.tar.gz

 

Fixed Savannah bugs:

  • 35978  MAIN_SRC SRC_C confusion
  •  35977  Translate Arduino examples script minor bugs
  •  35976  Find a better way to look for Python stuff in configure
  •  35975  Error/warning msg when configuring
  •  35974  Problems with script to translate Arduino examples
  •  35973  exit on failure in configure.ac
  •  35871  Example has file faulty include statement
  •  35965  Run time path into binaries
  •  35982  Don’t fetch Arduino sources if already there
  •  35873  Searduino can not create SHLIBs propoerly on x86_64
  •  35964  Code for Arduino HW can not use SEARDUINO_LOOP
  •  35980  Add option to set the number of pins
  •  35963  Generated examples (arduino-ex2c) miss init();
  •  35979  Fixes for manual
  •  35983  Inclue Arduino examples in dists
  •  35976  Find a better way to look for Python stuff in configure
  •  35870  Built in example code fails to load in Pardon
  •  35872  Example misses info on how to execute program
  •  35991  Converted example includes setup instead of searduno.h
  •  35990  PROG not set when converting arduino ex to C code
  • 36012  pearduino.so link not platofrm independet
  • 36042  Not easy to do conditional programming, DEBUG macro missing

Fixed Savannah tasks:

  • 11900  Move “sleep” code from examples to stubs
  • 11948  Test code to test bin releases
  • 11921  Add examples on how to check (and use) binary dist
  • 11963  Add target lib in searduino-arduino.mk
  • 11964  install target in Makefiles for Arduino