Increase test coverage

This commit is contained in:
Mike Cifelli 2017-11-26 15:11:41 -05:00
parent 314053a9eb
commit 0825d1ee96
4 changed files with 36 additions and 5 deletions

View File

@ -1,4 +1,4 @@
|TranscendentalLisp.Recursion||10:09:13 Sun, Nov 26, 2017|
|TranscendentalLisp.Recursion||15:06:26 Sun, Nov 26, 2017|
|TranscendentalLisp||16:15:14 Fri, Mar 17, 2017|
|TranscendentalLisp.Macros||10:10:15 Mon, Mar 13, 2017|
|TranscendentalLisp.MacroTests||10:07:00 Mon, Mar 13, 2017|

View File

@ -26,4 +26,4 @@ Test recursion capabilities of various functions.
| check | evaluate text | (eval (append `(let ,(list-of '(x 20) 10000)) big-list)) | 1 |
| check | evaluate text | (apply 'cond (list-of '((= 1 2) 1) 10000)) | NIL |
| check | evaluate text | (eval (append '(case :a) (list-of '((:b :c :d) 1) 10000))) | NIL |
| check | evaluate text | (nested-list 2000) | =~/\)\)$/ |
| check | evaluate text | (nested-list 1500) | =~/\)\)$/ |

View File

@ -38,11 +38,10 @@ public class TokenFactoryImpl implements TokenFactory {
case COMMA:
return new Comma(text, position);
default:
if (isNumeric(firstCharacter, text)) {
if (isNumeric(firstCharacter, text))
return new Number(text, position);
} else if (isLegalIdentifierCharacter(firstCharacter)) {
else if (isLegalIdentifierCharacter(firstCharacter))
return new Identifier(text, position);
}
}
throw new BadCharacterException(text, position);

View File

@ -0,0 +1,32 @@
package recursion;
import static recursion.TailCalls.done;
import org.junit.Test;
public class TailCallTest {
@Test(expected = UnsupportedOperationException.class)
public void tailCallDoesNotSupportResult() {
TailCall<Object> tailCall = new TailCall<Object>() {
@Override
public TailCall<Object> apply() {
return null;
}
};
tailCall.result();
}
@Test(expected = UnsupportedOperationException.class)
public void doneDoesNotSupportApply() {
done(null).apply();
}
@Test
public void TailCallsCoverage() {
new TailCalls();
}
}