A metronome using the FRDM K64F board

Committer:
ram54288
Date:
Sun May 14 18:40:18 2017 +0000
Revision:
0:a7a43371b306
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ram54288 0:a7a43371b306 1 # ==========================================
ram54288 0:a7a43371b306 2 # Unity Project - A Test Framework for C
ram54288 0:a7a43371b306 3 # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
ram54288 0:a7a43371b306 4 # [Released under MIT License. Please refer to license.txt for details]
ram54288 0:a7a43371b306 5 # ==========================================
ram54288 0:a7a43371b306 6
ram54288 0:a7a43371b306 7 require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
ram54288 0:a7a43371b306 8
ram54288 0:a7a43371b306 9 $colour_output = true
ram54288 0:a7a43371b306 10
ram54288 0:a7a43371b306 11 def report(message)
ram54288 0:a7a43371b306 12 if not $colour_output
ram54288 0:a7a43371b306 13 $stdout.puts(message)
ram54288 0:a7a43371b306 14 else
ram54288 0:a7a43371b306 15 message = message.join('\n') if (message.class == Array)
ram54288 0:a7a43371b306 16 message.each_line do |line|
ram54288 0:a7a43371b306 17 line.chomp!
ram54288 0:a7a43371b306 18 colour = case(line)
ram54288 0:a7a43371b306 19 when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i
ram54288 0:a7a43371b306 20 ($1.to_i == 0) ? :green : :red
ram54288 0:a7a43371b306 21 when /PASS/
ram54288 0:a7a43371b306 22 :green
ram54288 0:a7a43371b306 23 when /^OK$/
ram54288 0:a7a43371b306 24 :green
ram54288 0:a7a43371b306 25 when /(?:FAIL|ERROR)/
ram54288 0:a7a43371b306 26 :red
ram54288 0:a7a43371b306 27 when /IGNORE/
ram54288 0:a7a43371b306 28 :yellow
ram54288 0:a7a43371b306 29 when /^(?:Creating|Compiling|Linking)/
ram54288 0:a7a43371b306 30 :white
ram54288 0:a7a43371b306 31 else
ram54288 0:a7a43371b306 32 :silver
ram54288 0:a7a43371b306 33 end
ram54288 0:a7a43371b306 34 colour_puts(colour, line)
ram54288 0:a7a43371b306 35 end
ram54288 0:a7a43371b306 36 end
ram54288 0:a7a43371b306 37 $stdout.flush
ram54288 0:a7a43371b306 38 $stderr.flush
ram54288 0:a7a43371b306 39 end