Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
remove invalid jank tests

remove debug prints
  • Loading branch information
jianlingzhong committed Jan 27, 2025
1 parent 5ccb29a commit a9ccbf4
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 460 deletions.
1 change: 0 additions & 1 deletion compiler+runtime/include/cpp/jank/analyze/expr/case.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace jank::analyze::expr

void propagate_position(expression_position const pos)
{
std::cout << "set case expr position to " << expression_position_str(pos) << "\n";
default_expr->propagate_position(pos);
for(auto &expr : exprs)
{
Expand Down
1 change: 0 additions & 1 deletion compiler+runtime/include/cpp/jank/analyze/expr/if.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace jank::analyze::expr

void propagate_position(expression_position const pos)
{
std::cout << "set if expr position to" << expression_position_str(pos) << "\n";
position = pos;
if(then)
{
Expand Down
5 changes: 0 additions & 5 deletions compiler+runtime/src/cpp/jank/codegen/llvm_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,6 @@ namespace jank::codegen
/* If we're in return position, our then/else branches will generate return instructions
* for us. Since LLVM basic blocks can only have one terminating instruction, we need
* to take care to not generate our own, too. */
std::cout << "llvm_processor::gen: if position is " << expression_position_str(expr.position)
<< "\n";
std::cout << "llvm_processor::gen: if.then position is "
<< expression_position_str(expr.then->get_base()->position) << "\n";
auto const is_return(expr.position == expression_position::tail);
auto const condition(gen(expr.condition, arity));
auto const truthy_fn_type(
Expand Down Expand Up @@ -906,7 +902,6 @@ namespace jank::codegen
expr::function_arity<expression> const &arity)
{
/* TODO: Generate direct call to __cxa_throw. */
std::cout << "gen throw: position is " << expression_position_str(expr.position) << "\n";
auto const value(gen(expr.value, arity));
auto const fn_type(
llvm::FunctionType::get(ctx->builder->getPtrTy(), { ctx->builder->getPtrTy() }, false));
Expand Down
133 changes: 2 additions & 131 deletions compiler+runtime/test/jank/form/case/pass-basic-case-tests.jank
Original file line number Diff line number Diff line change
@@ -1,132 +1,3 @@
(case 1 1 :one
2 :two
"3" :three
:default)

(case "3" 1 :one
2 :two
"3" :three
:default)

(case true true :yes
false :no
:default)

(case nil
nil :empty
false :false-value
:default)

(case 0
0 :zero
1 :one
2 :two
:default)

(case "hello" "world" :world
"hello" :greeting
"Clojure" :language
:default)

;(let* [clojure_core-G__-4480 "FB"]
; (case* clojure_core-G__-4480 0 0 :default
; {2782171365 (clojure.core/condp clojure.core/= clojure_core-G__-4480 3731966369 (clojure.core/condp clojure.core/= clojure_core-G__-4480 (quote "FB") :hash-collision
; (quote "Ea") :hash-collision
; :default)
; :default)}
; :compact :hash-equiv #{3731966369}))


(case 3.14
3.14 :pi
2.71 :e
1.61 :phi
:default)

(assert
(=
(case 1
1 :one
2 :two
"3" :three
:default)
:one))

(assert
(=
(case "3"
1 :one
2 :two
"3" :three
:default)
:three))

(assert
(=
(case true
true :yes
false :no
:default)
:yes))

(assert
(=
(case nil
nil :empty
false :false-value
:default)
:empty))

(assert
(=
(case 0
0 :zero
1 :one
2 :two
:default)
:zero))

(assert
(=
(case "hello"
"world" :world
"hello" :greeting
"Clojure" :language
:default)
:greeting))

(assert
(=
(case 3.14
3.14 :pi
2.71 :e
1.61 :phi
:default)
:pi))

(assert
(=
(case 'symbol symbol :symbol-match
other :symbol-no-match
:symbol-fallback)
:symbol-match))

;does not work in jank yet
;(assert
; (=
; (case \a \a \b
; \c \d
; :not-found)
; \b))
(assert
(=
(case "AaAaAaAa" "AaAaAaAa" :hasha
"BBBBBBBB" :hashb
:default), :hasha))


:success
=======
;; value position tests
(let [x (case 1 1 :one
2 :two
Expand Down Expand Up @@ -307,11 +178,11 @@
:ignored)]
(assert (= (f) :ignored) "Hash collision check - statement position"))

;; Character test (commented out as non-working yet)
;; Character test (commented out as non-working)
#_(let [f (fn []
(case \a \a \b
\c \d
:not-found))]
(assert (= (f) \b) "Character match"))

:success
:success
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
(assert (= x "tuple-match")))

(let [x (case 'symbol
'symbol :symbol-match
'other :symbol-no-match
symbol :symbol-match
other :symbol-no-match
:symbol-fallback)]
(assert (= x :symbol-match)))

Expand Down

This file was deleted.

80 changes: 0 additions & 80 deletions compiler+runtime/test/jank/form/case/pass-complex-keys.jank

This file was deleted.

Loading

0 comments on commit a9ccbf4

Please sign in to comment.