nendo 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ ;;-*- mode: nendo; syntax: scheme -*-;;
2
+ ;; test for nendo's core utility
3
+
4
+ (use nendo.test)
5
+ (test-start "nendo's core utility")
6
+
7
+ ;;===================================================================
8
+ (test-section "pretty-print-to-string")
9
+ (define test-sexp1 '(a (b (c))))
10
+ (define test-sexp2 '(define (function1 a b c) (+ a b c)))
11
+
12
+ (test* "pretty-print-to-string"
13
+ (string-join
14
+ '("(a\n"
15
+ " (b\n"
16
+ " (c)))\n"))
17
+ (pretty-print-to-string test-sexp1))
18
+
19
+ (test* "pretty-print-to-string"
20
+ (string-join
21
+ '("(define\n"
22
+ " (function1 a b c)\n"
23
+ " (+ a b c))\n"))
24
+ (pretty-print-to-string test-sexp2))
25
+
26
+
27
+ ;;-------------------------------------------------------------------
28
+ (test-section "disasm")
29
+
30
+ (define (dummy-function arg1)
31
+ (let1 var (+ arg1 1)
32
+ var))
33
+
34
+ (test* "disasm info"
35
+ " file: ./test/nendo_util.nnd
36
+ lineno: 30
37
+ source:
38
+ (define
39
+ (dummy-function arg1)
40
+ (let1 var
41
+ (+ arg1 1) var))
42
+ expanded:
43
+ (define
44
+ (' dummy-function)
45
+ (lambda
46
+ ('
47
+ (arg1))
48
+ (let
49
+ (((' var)
50
+ (+ arg1 1))) var)))
51
+ "
52
+ (disasm 'dummy-function 'info))
53
+ (test* "disasm source "
54
+ '(define (dummy-function arg1) (let1 var (+ arg1 1) var))
55
+ (disasm 'dummy-function 'source))
56
+ (test* "disasm expanded"
57
+ '(define 'dummy-function (lambda '(arg1) (let (('var (+ arg1 1))) var)))
58
+ (disasm 'dummy-function 'expanded))
59
+ (test* "disasm ruby-code"
60
+ "
61
+ trampCall(
62
+ begin
63
+ def self._dummy_MIMARKfunction_METHOD( origname, pred, args ) lispMethodEntry( origname, true ) ; ret = callProcedure( origname, pred, args ) ; lispMethodExit( origname, true ) ; return ret end
64
+ @global_lisp_binding['_dummy_MIMARKfunction'] = self.method( :_dummy_MIMARKfunction_METHOD )
65
+ @_dummy_MIMARKfunction =
66
+ trampCall(
67
+ Proc.new { |_arg1|
68
+ begin
69
+ ___lambda = lambda { |_var|
70
+ begin
71
+ trampCall(_var)
72
+ rescue => __e ; __e.set_backtrace( [\"./test/nendo_util.nnd:32\"] + __e.backtrace ) ; raise __e
73
+ end
74
+ } ; ___lambda.call(
75
+ trampCall( self.__PLMARK_METHOD( '+',
76
+ begin
77
+ if @global_lisp_binding.has_key?('__PLMARK') then
78
+ trampCall(@__PLMARK)
79
+ else raise NameError.new( \"Error: undefined variable __PLMARK\", \"__PLMARK\" ) end
80
+ rescue => __e ; __e.set_backtrace( [\"./test/nendo_util.nnd:31\"] + __e.backtrace ) ; raise __e
81
+ end ,
82
+ Cell.new(
83
+ begin
84
+ trampCall(_arg1)
85
+ rescue => __e ; __e.set_backtrace( [\"./test/nendo_util.nnd:31\"] + __e.backtrace ) ; raise __e
86
+ end ,Cell.new(
87
+ 1
88
+ ))))
89
+ )
90
+ end
91
+ }
92
+ )
93
+ end
94
+ )"
95
+ (disasm 'dummy-function))
96
+
97
+ ;;===================================================================
98
+ (test-end)
data/test/srfi-1-test.nnd CHANGED
@@ -335,6 +335,10 @@
335
335
  (map + '(3 1 4 1) (circular-list 1 0)))
336
336
  (fail 'map:1))
337
337
 
338
+ (or (equal? 99990000
339
+ (apply + (map (lambda (x) (* x 2)) (iota 10000))))
340
+ (fail 'map:2))
341
+
338
342
  (or (equal? '(5 4 3 2 1)
339
343
  (let ((v 1)
340
344
  (l '()))
@@ -347,6 +351,14 @@
347
351
  l))
348
352
  (fail 'for-each:1))
349
353
 
354
+ (or (equal? 49995000
355
+ (let1 total 0
356
+ (for-each
357
+ (lambda (x) (set! total (+ x total)))
358
+ (iota 10000))
359
+ total))
360
+ (fail 'for-each:2))
361
+
350
362
  (or (equal? '(1 -1 3 -3 8 -8)
351
363
  (append-map (lambda (x) (list x (- x))) '(1 3 8)))
352
364
  (fail 'append-map:1))
@@ -383,9 +395,25 @@
383
395
  (circular-list 1 2)))
384
396
  (fail 'filter-map:1))
385
397
 
398
+ (or (equal? '(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
399
+ (filter-map (lambda (x) (when (< x 10) (- x))) (iota 1000)))
400
+ (fail 'filter-map:2))
401
+
402
+ (or (equal? 10000
403
+ (length (filter-map (lambda (x) x) (iota 10000))))
404
+ (fail 'filter-map:3))
405
+
386
406
  (or (equal? '(0 8 8 -4) (filter even? '(0 7 8 8 43 -4)))
387
407
  (fail 'filter:1))
388
408
 
409
+ (or (equal? '(0 1 2 3 4 5 6 7 8 9)
410
+ (filter (lambda (x) (< x 10)) (range 1000)))
411
+ (fail 'filter:2))
412
+
413
+ (or (equal? 10000
414
+ (length (filter (lambda (x) x) (iota 10000))))
415
+ (fail 'filter:3))
416
+
389
417
  (or (let-values (((a b) (partition symbol? '(one 2 3 four five 6))))
390
418
  (and (equal? a '(one four five))
391
419
  (equal? b '(2 3 6))))
data/test/textlib.nnd ADDED
@@ -0,0 +1,24 @@
1
+ ;;-*- mode: nendo; syntax: scheme -*-;;
2
+ ;; test for text.* ( ported from Gauche by kiyoka )
3
+
4
+ (use nendo.test)
5
+ (test-start "text utilities")
6
+
7
+ ;;===================================================================
8
+ ;;-------------------------------------------------------------------
9
+ (test-section "tree")
10
+ (use text.tree)
11
+ (test-module 'text.tree)
12
+
13
+ (test* "tree->string" "" (tree->string '()))
14
+ (test* "tree->string" "" (tree->string ""))
15
+ (test* "tree->string" "ab" (tree->string "ab"))
16
+ (test* "tree->string" "ab" (tree->string 'ab))
17
+ (test* "tree->string" "ab" (tree->string '(a . b)))
18
+ (test* "tree->string" "ab" (tree->string '(a b)))
19
+ (test* "tree->string" "Ab" (tree->string '(:A . :b)))
20
+ (test* "tree->string" "ab" (tree->string '((((() ())) . a) ((((b)))))))
21
+
22
+
23
+ ;;===================================================================
24
+ (test-end)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 3
9
- version: 0.3.3
8
+ - 4
9
+ version: 0.3.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kiyoka Nishiyama
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-24 00:00:00 +09:00
17
+ date: 2010-09-09 00:00:00 +09:00
18
18
  default_executable: nendo
19
19
  dependencies: []
20
20
 
@@ -29,23 +29,31 @@ extra_rdoc_files:
29
29
  files:
30
30
  - bin/nendo
31
31
  - emacs/nendo-mode.el
32
+ - example/KyotoCabinet/kcbench.rb
33
+ - example/KyotoCabinet/kcbench1.nnd
34
+ - example/KyotoCabinet/kcbench2.nnd
35
+ - example/KyotoCabinet/kcbench3.nnd
32
36
  - example/cgi/dekamoji.cgi
33
37
  - example/cgi/sample.cgi
34
38
  - example/deep-loop1.nnd
35
39
  - example/deep-loop2.nnd
36
40
  - example/exit.nnd
41
+ - example/export-lisp-functions.rb
37
42
  - example/fact.nnd
38
43
  - example/fizzbuzz1.nnd
39
44
  - example/html-lite-sample.nnd
40
45
  - example/nqueen.nnd
41
46
  - example/scratch.nnd
42
47
  - example/tak.nnd
48
+ - example/tak_ruby_version.rb
43
49
  - example/twitterTL.nnd
44
50
  - lib/debug/syslog.nnd
45
51
  - lib/debug/syslog.nndc
46
52
  - lib/init.nnd
47
53
  - lib/init.nndc
48
54
  - lib/nendo.rb
55
+ - lib/nendo/test.nnd
56
+ - lib/nendo/test.nndc
49
57
  - lib/srfi-1.nnd
50
58
  - lib/srfi-1.nndc
51
59
  - lib/text/html-lite.nnd
@@ -53,7 +61,9 @@ files:
53
61
  - lib/text/tree.nnd
54
62
  - lib/text/tree.nndc
55
63
  - test/nendo_spec.rb
64
+ - test/nendo_util.nnd
56
65
  - test/srfi-1-test.nnd
66
+ - test/textlib.nnd
57
67
  - README
58
68
  has_rdoc: true
59
69
  homepage: http://github.com/kiyoka/nendo