1 #include "clangmm.hpp" 2 #include <cassert> 3 #include <memory> 4 #include <string> 5 main()6int main() { 7 std::string tests_path = LIBCLANGMM_TESTS_PATH; 8 std::string path(tests_path + "/case/main.cpp"); 9 10 auto index = std::make_shared<clangmm::Index>(0, 0); 11 12 clangmm::TranslationUnit tu(index, path, {}); 13 auto tokens = tu.get_tokens(0, 113); 14 15 auto offsets = (*tokens)[28].get_source_range().get_offsets(); 16 17 assert(offsets.first.line == 6 && offsets.first.index == 3); 18 assert(offsets.second.line == 6 && offsets.second.index == 9); 19 } 20