diff options
author | Adrian Kummerlaender | 2015-01-17 20:34:11 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-01-17 20:34:11 +0100 |
commit | ec52d63d3caca690e822e1a07ba9c2f47710b4d5 (patch) | |
tree | 32ee250989596b786a55f5a6bc55f42bf6321dd8 /test.cc | |
parent | 123ce87e66013bc11bf0d9ca01776a60cf47c89b (diff) | |
download | TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar.gz TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar.bz2 TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar.lz TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar.xz TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.tar.zst TypeAsValue-ec52d63d3caca690e822e1a07ba9c2f47710b4d5.zip |
Implemented `Nth` function
* as its name implies this function returns the _nth_ value of a given _Cons_ structure
* added appropriate test case
Diffstat (limited to 'test.cc')
-rw-r--r-- | test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -53,6 +53,15 @@ TEST_F(TypeAsValueTest, List) { EXPECT_EQ(2, ( tav::Head<tav::Tail<tav::List<tav::Int<1>, tav::Int<2>, tav::Int<3>>::type>>::value )); } +TEST_F(TypeAsValueTest, ListNth) { + // (nth 0 (list 1)) + EXPECT_EQ(1, ( tav::Nth<tav::Size<0>, tav::List<tav::Int<1>>::type>::type::value )); + // (nth 0 (list 1 2)) + EXPECT_EQ(1, ( tav::Nth<tav::Size<0>, tav::List<tav::Int<1>, tav::Int<2>>::type>::type::value )); + // (nth 1 (list 1 2)) + EXPECT_EQ(2, ( tav::Nth<tav::Size<1>, tav::List<tav::Int<1>, tav::Int<2>>::type>::type::value )); +} + TEST_F(TypeAsValueTest, ListConcatenate) { // (length (concatenate (list 1) (list 2))) EXPECT_EQ(2, ( tav::Length<tav::Concatenate<tav::List<tav::Int<1>>::type, tav::List<tav::Int<2>>::type>::type>::type::value )); |