Skip to content

Instantly share code, notes, and snippets.

var obj = {};
obj.push = Array.prototype.push;
obj.length = 4294967295;
//CHECK#1
var push = obj.push("x", "y", "z");
if (push !== 4294967298) {
$ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push("x", "y", "z") === 4294967298. Actual: ' + (push));
}
// CHECK#5
if (!(isFinite("string") === false)) {
$ERROR('#5: "string" === Not-a-Finite. Actual: ' + ("string"));
}
// CHECK#1
if (!(isFinite({}) === false)) {
$ERROR('#1: {} === Not-a-Finite. Actual: ' + ({}));
}
if (isNaN(parseInt("\u000B")) !== true) {
print('parseInt("\\u000B") === Not-a-Number. Actual: ' + (parseInt("\u000B")));
}
@pedrodelgallego
pedrodelgallego / evaluator-test.scm
Created July 28, 2010 08:07
A Scheme intrepreter that allow you to run top level programs.
#lang racket/base
(require rackunit "kernel.rkt")
(define (test description test-case result)
(display ".")
(check-equal? (evaluate test-case) result description))
;; Test Simple data types.
(test "the false value" #f #f)
#lang racket/base
(require racket/match)
;; ------------------------------------- Define booleans
(define the-false-value #f)
;; ------------------------------------- Data Types Predicates.
(define (boolean? x )
(or (eq? x the-false-value) (eq? x (not the-false-value)) ))
"use strict"
var str = "";
var strObj_ = new String();
////////////////////////////////////////////////////////////
// CHECK#6
if (str === strObj_){
$ERROR('#6: objects of str=""; and strObj=new String(); are not equal');
}
/**
* @name: S8.7.2_A3_T1;
* @section: 8.7.2;
* @assertion: x = 1 calls PutValue(V,W) setting the new value of V
* @description: Execute x = 1, that calls PutValue(V,W) where V is an unresolved
* reference in a strict mode scope.
* A ReferenceError should be throw
*/
;; xercise 1 - Cellular Automaton - Cellular automata are fun and fairly easy to implement.
;; In this exercise you will build Conway's Game of Life in Clojure with a Swing GUI.
;; Kudos For Oregu (author).
(ns life
(:import (javax.swing JFrame JPanel JButton JTextArea JLabel SwingUtilities JScrollPane WindowConstants)
(java.awt Graphics BorderLayout FlowLayout Color Dimension)
(java.awt.event MouseListener ActionListener MouseEvent MouseAdapter))
(:use [clojure.contrib.seq-utils :only (flatten)]))
(add-to-list 'load-path "~/.emacs.d/erc")
(require 'erc)
;; Only track my nick(s)
(defadvice erc-track-find-face (around erc-track-find-face-promote-query activate)
(if (erc-query-buffer-p)
(setq ad-return-value (intern "erc-current-nick-face"))
ad-do-it))
(setq erc-keywords '("Lau" "lau" "ljensen"))
Scenario: List the most popular gists of the moment # features/home_page.feature:5
Given I am on the homepage # features/step_definitions/web_steps.rb:18
And an awesome gist exists # features/step_definitions/base_steps.rb:1
Then I should see "This gist is awesome" # features/step_definitions/web_steps.rb:99
undefined method `assert' for #<Object:0x..fdb40ebbe> (NoMethodError)
./features/step_definitions/web_steps.rb:104
./features/step_definitions/web_steps.rb:13:in `with_scope'
./features/step_definitions/web_steps.rb:100:in `/^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/'
features/home_page.feature:8:in `Then I should see "This gist is awesome"'