Next: , Previous: , Up: Usage   [Contents][Index]


3.1 Mutation

The following example code;

  1. loads an asm software object from a file,
  2. mutates the object, and then
  3. writes the a modified version of the object to disk
  4. and prints the applied mutation.
(in-package :software-evolution-example)

;; gcd.s may be compiled from gcd.c in the test/ directory.
(let ((orig (from-file (make-instance 'asm) "../test/gcd/gcd.s"))) ; (1)
  (multiple-value-bind (mutant edit) (mutate (copy *original*)) ; (2)
    (let ((temp (temp-file-name "s")))
      (to-file mutant temp)                                      ; (3)
      (format t "Results of applying ~S to gcd written to ~S.~%" ; (4)
              edit temp))))

Executing this code will print output resembling the following.

Results of applying (:CUT 44) to gcd written to "/tmp/fileyfH5Hx.s".