Index: clangd/CodeComplete.cpp =================================================================== --- clangd/CodeComplete.cpp +++ clangd/CodeComplete.cpp @@ -1463,7 +1463,7 @@ llvm::DenseMap BundleLookup; auto AddToBundles = [&](const CodeCompletionResult *SemaResult, const Symbol *IndexResult, - const RawIdentifier *IdentifierResult = nullptr) { + const RawIdentifier *IdentifierResult) { CompletionCandidate C; C.SemaResult = SemaResult; C.IndexResult = IndexResult; @@ -1502,12 +1502,12 @@ }; // Emit all Sema results, merging them with Index results if possible. for (auto &SemaResult : SemaResults) - AddToBundles(&SemaResult, CorrespondingIndexResult(SemaResult)); + AddToBundles(&SemaResult, CorrespondingIndexResult(SemaResult), nullptr); // Now emit any Index-only results. for (const auto &IndexResult : IndexResults) { if (UsedIndexResults.count(&IndexResult)) continue; - AddToBundles(/*SemaResult=*/nullptr, &IndexResult); + AddToBundles(/*SemaResult=*/nullptr, &IndexResult, nullptr); } // Emit identifier results. for (const auto &Ident : IdentifierResults) Index: clangd/StdSymbolMap.inc =================================================================== --- clangd/StdSymbolMap.inc +++ clangd/StdSymbolMap.inc @@ -134,12 +134,15 @@ SYMBOL(bad_variant_access, std::, ) SYMBOL(bad_weak_ptr, std::, ) SYMBOL(basic_common_reference, std::, ) +SYMBOL(basic_filebuf, std::, ) SYMBOL(basic_fstream, std::, ) SYMBOL(basic_ifstream, std::, ) SYMBOL(basic_ios, std::, ) SYMBOL(basic_iostream, std::, ) +SYMBOL(basic_istream, std::, ) SYMBOL(basic_istringstream, std::, ) SYMBOL(basic_ofstream, std::, ) +SYMBOL(basic_ostream, std::, ) SYMBOL(basic_ostringstream, std::, ) SYMBOL(basic_osyncstream, std::, ) SYMBOL(basic_regex, std::, ) @@ -193,6 +196,7 @@ SYMBOL(codecvt, std::, ) SYMBOL(codecvt_base, std::, ) SYMBOL(codecvt_byname, std::, ) +SYMBOL(codecvt_mode, std::, ) SYMBOL(codecvt_utf16, std::, ) SYMBOL(codecvt_utf8, std::, ) SYMBOL(codecvt_utf8_utf16, std::, ) @@ -245,6 +249,7 @@ SYMBOL(declare_reachable, std::, ) SYMBOL(declval, std::, ) SYMBOL(default_delete, std::, ) +SYMBOL(default_random_engine, std::, ) SYMBOL(default_searcher, std::, ) SYMBOL(defaultfloat, std::, ) SYMBOL(defer_lock, std::, ) @@ -264,8 +269,10 @@ SYMBOL(disjunction, std::, ) SYMBOL(disjunction_v, std::, ) SYMBOL(distance, std::, ) +SYMBOL(div_t, std::, ) SYMBOL(divides, std::, ) SYMBOL(domain_error, std::, ) +SYMBOL(double_t, std::, ) SYMBOL(dynamic_extent, std::, ) SYMBOL(dynamic_pointer_cast, std::, ) SYMBOL(emit_on_flush, std::, ) @@ -298,6 +305,7 @@ SYMBOL(extent, std::, ) SYMBOL(extent_v, std::, ) SYMBOL(extreme_value_distribution, std::, ) +SYMBOL(fabs, std::, ) SYMBOL(false_type, std::, ) SYMBOL(fclose, std::, ) SYMBOL(fdim, std::, ) @@ -323,6 +331,7 @@ SYMBOL(fgets, std::, ) SYMBOL(fgetwc, std::, ) SYMBOL(fgetws, std::, ) +SYMBOL(filebuf, std::, ) SYMBOL(fill, std::, ) SYMBOL(fill_n, std::, ) SYMBOL(find, std::, ) @@ -334,6 +343,7 @@ SYMBOL(fixed, std::, ) SYMBOL(float_denorm_style, std::, ) SYMBOL(float_round_style, std::, ) +SYMBOL(float_t, std::, ) SYMBOL(floor, std::, ) SYMBOL(floor2, std::, ) SYMBOL(flush, std::, ) @@ -422,6 +432,9 @@ SYMBOL(ignore, std::, ) SYMBOL(ilogb, std::, ) SYMBOL(imag, std::, ) +SYMBOL(imaxabs, std::, ) +SYMBOL(imaxdiv, std::, ) +SYMBOL(imaxdiv_t, std::, ) SYMBOL(in_place, std::, ) SYMBOL(in_place_index, std::, ) SYMBOL(in_place_index_t, std::, ) @@ -440,6 +453,8 @@ SYMBOL(integer_sequence, std::, ) SYMBOL(integral_constant, std::, ) SYMBOL(internal, std::, ) +SYMBOL(intmax_t, std::, ) +SYMBOL(intptr_t, std::, ) SYMBOL(invalid_argument, std::, ) SYMBOL(invoke, std::, ) SYMBOL(invoke_result, std::, ) @@ -619,6 +634,7 @@ SYMBOL(isnan, std::, ) SYMBOL(isnormal, std::, ) SYMBOL(ispow2, std::, ) +SYMBOL(istream, std::, ) SYMBOL(istream_iterator, std::, ) SYMBOL(istreambuf_iterator, std::, ) SYMBOL(istringstream, std::, ) @@ -642,11 +658,15 @@ SYMBOL(jmp_buf, std::, ) SYMBOL(kill_dependency, std::, ) SYMBOL(kilo, std::, ) +SYMBOL(knuth_b, std::, ) +SYMBOL(labs, std::, ) SYMBOL(launch, std::, ) SYMBOL(launder, std::, ) SYMBOL(lcm, std::, ) SYMBOL(lconv, std::, ) SYMBOL(ldexp, std::, ) +SYMBOL(ldiv, std::, ) +SYMBOL(ldiv_t, std::, ) SYMBOL(left, std::, ) SYMBOL(length_error, std::, ) SYMBOL(less, std::, ) @@ -656,6 +676,9 @@ SYMBOL(lgamma, std::, ) SYMBOL(linear_congruential_engine, std::, ) SYMBOL(list, std::, ) +SYMBOL(llabs, std::, ) +SYMBOL(lldiv, std::, ) +SYMBOL(lldiv_t, std::, ) SYMBOL(llrint, std::, ) SYMBOL(llround, std::, ) SYMBOL(locale, std::, ) @@ -731,6 +754,8 @@ SYMBOL(min_element, std::, ) SYMBOL(minmax, std::, ) SYMBOL(minmax_element, std::, ) +SYMBOL(minstd_rand, std::, ) +SYMBOL(minstd_rand0, std::, ) SYMBOL(minus, std::, ) SYMBOL(mismatch, std::, ) SYMBOL(mktime, std::, ) @@ -745,6 +770,8 @@ SYMBOL(move_backward, std::, ) SYMBOL(move_if_noexcept, std::, ) SYMBOL(move_iterator, std::, ) +SYMBOL(mt19937, std::, ) +SYMBOL(mt19937_64, std::, ) SYMBOL(multimap, std::, ) SYMBOL(multiplies, std::, ) SYMBOL(multiset, std::, ) @@ -793,6 +820,7 @@ SYMBOL(ofstream, std::, ) SYMBOL(once_flag, std::, ) SYMBOL(optional, std::, ) +SYMBOL(ostream, std::, ) SYMBOL(ostream_iterator, std::, ) SYMBOL(ostreambuf_iterator, std::, ) SYMBOL(ostringstream, std::, ) @@ -851,6 +879,10 @@ SYMBOL(range_error, std::, ) SYMBOL(rank, std::, ) SYMBOL(rank_v, std::, ) +SYMBOL(ranlux24, std::, ) +SYMBOL(ranlux24_base, std::, ) +SYMBOL(ranlux48, std::, ) +SYMBOL(ranlux48_base, std::, ) SYMBOL(ratio, std::, ) SYMBOL(ratio_add, std::, ) SYMBOL(ratio_divide, std::, ) @@ -1086,6 +1118,8 @@ SYMBOL(u32streampos, std::, ) SYMBOL(u32string, std::, ) SYMBOL(u32string_view, std::, ) +SYMBOL(uintmax_t, std::, ) +SYMBOL(uintptr_t, std::, ) SYMBOL(uncaught_exceptions, std::, ) SYMBOL(undeclare_no_pointers, std::, ) SYMBOL(undeclare_reachable, std::, ) @@ -1184,17 +1218,21 @@ SYMBOL(wctob, std::, ) SYMBOL(wctomb, std::, ) SYMBOL(wctrans, std::, ) +SYMBOL(wctrans_t, std::, ) SYMBOL(wctype, std::, ) +SYMBOL(wctype_t, std::, ) SYMBOL(weak_equal, std::, ) SYMBOL(weak_equality, std::, ) SYMBOL(weak_order, std::, ) SYMBOL(weak_ordering, std::, ) SYMBOL(weak_ptr, std::, ) SYMBOL(weibull_distribution, std::, ) +SYMBOL(wfilebuf, std::, ) SYMBOL(wfstream, std::, ) SYMBOL(wifstream, std::, ) SYMBOL(wios, std::, ) SYMBOL(wiostream, std::, ) +SYMBOL(wistream, std::, ) SYMBOL(wistringstream, std::, ) SYMBOL(wmemchr, std::, ) SYMBOL(wmemcmp, std::, ) @@ -1202,6 +1240,7 @@ SYMBOL(wmemmove, std::, ) SYMBOL(wmemset, std::, ) SYMBOL(wofstream, std::, ) +SYMBOL(wostream, std::, ) SYMBOL(wostringstream, std::, ) SYMBOL(wosyncstream, std::, ) SYMBOL(wprintf, std::, ) Index: clangd/include-mapping/gen_std.py =================================================================== --- clangd/include-mapping/gen_std.py +++ clangd/include-mapping/gen_std.py @@ -31,8 +31,12 @@ from bs4 import BeautifulSoup import argparse +import collections import datetime +import multiprocessing import os +import re +import signal import sys STDGEN_CODE_PREFIX = """\ @@ -47,7 +51,13 @@ //===----------------------------------------------------------------------===// """ -def ParseSymbolPage(symbol_page_html): +def HasClass(tag, *classes): + for c in tag.get('class', []): + if c in classes: + return True + return False + +def ParseSymbolPage(symbol_page_html, symbol_name): """Parse symbol page and retrieve the include header defined in this page. The symbol page provides header for the symbol, specifically in "Defined in header
" section. An example: @@ -58,17 +68,43 @@ Returns a list of headers. """ - headers = [] + headers = set() + all_headers = set() soup = BeautifulSoup(symbol_page_html, "html.parser") - # "Defined in header " are defined in or - # . - for header_tr in soup.select('tr.t-dcl-header,tr.t-dsc-header'): - if "Defined in header " in header_tr.text: - # The interesting header content (e.g. ) is wrapped in . - for header_code in header_tr.find_all("code"): - headers.append(header_code.text) - return headers + # Rows in table are like: + # Defined in header .t-dsc-header + # Defined in header .t-dsc-header + # decl1 .t-dcl + # Defined in header .t-dsc-header + # decl2 .t-dcl + for table in soup.select('table.t-dcl-begin, table.t-dsc-begin'): + current_headers = [] + was_decl = False + for row in table.select('tr'): + if HasClass(row, 't-dcl', 't-dsc'): + was_decl = True + # Declaration is in the first cell. + text = row.find('td').text + # Decl may not be for the symbol name we're looking for. + if not re.search("\\b%s\\b" % symbol_name, text): + continue + headers.update(current_headers) + elif HasClass(row, 't-dsc-header'): + # If we saw a decl since the last header, this is a new block of headers + # for a new block of decls. + if was_decl: + current_headers = [] + was_decl = False + # There are also .t-dsc-header for "defined in namespace". + if not "Defined in header " in row.text: + continue + # The interesting header content (e.g. ) is wrapped in . + for header_code in row.find_all("code"): + current_headers.append(header_code.text) + all_headers.add(header_code.text) + # If the symbol was never named, consider all named headers. + return headers or all_headers def ParseIndexPage(index_page_html): @@ -101,7 +137,12 @@ self.headers = headers -def GetSymbols(root_dir, index_page_name, namespace): +def ReadSymbolPage(path, name): + with open(path) as f: + return ParseSymbolPage(f.read(), name) + + +def GetSymbols(pool, root_dir, index_page_name, namespace): """Get all symbols listed in the index page. All symbols should be in the given namespace. @@ -114,24 +155,22 @@ # contains the defined header. # 2. Parse the symbol page to get the defined header. index_page_path = os.path.join(root_dir, index_page_name) - symbols = [] with open(index_page_path, "r") as f: - # A map from symbol name to a set of headers. - symbol_headers = {} + # Read each symbol page in parallel. + results = [] # (symbol_name, promise of [header...]) for symbol_name, symbol_page_path in ParseIndexPage(f.read()): - with open(os.path.join(root_dir, symbol_page_path), "r") as f: - headers = ParseSymbolPage(f.read()) - if not headers: - sys.stderr.write("No header found for symbol %s at %s\n" % (symbol_name, - symbol_page_path)) - continue - - if symbol_name not in symbol_headers: - symbol_headers[symbol_name] = set() - symbol_headers[symbol_name].update(headers) - - for name, headers in sorted(symbol_headers.items(), key=lambda t : t[0]): - symbols.append(Symbol(name, namespace, list(headers))) + path = os.path.join(root_dir, symbol_page_path) + results.append((symbol_name, + pool.apply_async(ReadSymbolPage, (path, symbol_name)))) + + # Build map from symbol name to a set of headers. + symbol_headers = collections.defaultdict(set) + for symbol_name, lazy_headers in results: + symbol_headers[symbol_name].update(lazy_headers.get()) + + symbols = [] + for name, headers in sorted(symbol_headers.items(), key=lambda t : t[0]): + symbols.append(Symbol(name, namespace, list(headers))) return symbols @@ -169,8 +208,16 @@ ] symbols = [] - for root_dir, page_name, namespace in parse_pages: - symbols.extend(GetSymbols(root_dir, page_name, namespace)) + # Run many workers to process individual symbol pages under the symbol index. + # Don't allow workers to capture Ctrl-C. + pool = multiprocessing.Pool( + initializer=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)) + try: + for root_dir, page_name, namespace in parse_pages: + symbols.extend(GetSymbols(pool, root_dir, page_name, namespace)) + finally: + pool.terminate() + pool.join() # We don't have version information from the unzipped offline HTML files. # so we use the modified time of the symbol_index.html as the version. @@ -179,12 +226,16 @@ os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d') print STDGEN_CODE_PREFIX % cppreference_modified_date for symbol in symbols: - if len(symbol.headers) > 1: + if len(symbol.headers) == 1: + # SYMBOL(unqualified_name, namespace, header) + print "SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace, + symbol.headers[0]) + elif len(symbol.headers) == 0: + sys.stderr.write("No header found for symbol %s\n" % symbol.name) + else: # FIXME: support symbols with multiple headers (e.g. std::move). - continue - # SYMBOL(unqualified_name, namespace, header) - print "SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace, - symbol.headers[0]) + sys.stderr.write("Ambiguous header for symbol %s: %s\n" % ( + symbol.name, ', '.join(symbol.headers))) if __name__ == '__main__': Index: clangd/include-mapping/test.py =================================================================== --- clangd/include-mapping/test.py +++ clangd/include-mapping/test.py @@ -46,9 +46,13 @@ + + void foo() + this is matched + """ - self.assertEqual(ParseSymbolPage(html), ['']) + self.assertEqual(ParseSymbolPage(html, 'foo'), set([''])) def testParseSymbolPage_MulHeaders(self): @@ -63,6 +67,10 @@ + + void bar() + this mentions foo, but isn't matched +
Defined in header <cstdio>
@@ -75,10 +83,14 @@ + + void foo() + this is matched + """ - self.assertEqual(ParseSymbolPage(html), - ['', '', '']) + self.assertEqual(ParseSymbolPage(html, "foo"), + set(['', ''])) def testParseSymbolPage_MulHeadersInSameDiv(self): @@ -86,6 +98,7 @@ # Defined in header # Defined in header html = """ + + + + + +
Defined in header <algorithm>
@@ -93,8 +106,14 @@
void foo()this is matched
""" - self.assertEqual(ParseSymbolPage(html), ['', '']) + self.assertEqual(ParseSymbolPage(html, "foo"), + set(['', ''])) if __name__ == '__main__': Index: clangd/index/Serialization.cpp =================================================================== --- clangd/index/Serialization.cpp +++ clangd/index/Serialization.cpp @@ -314,8 +314,8 @@ Sym.Definition = readLocation(Data, Strings); Sym.CanonicalDeclaration = readLocation(Data, Strings); Sym.References = Data.consumeVar(); - Sym.Flags = static_cast(Data.consumeVar()); - Sym.Origin = static_cast(Data.consumeVar()); + Sym.Flags = static_cast(Data.consume8()); + Sym.Origin = static_cast(Data.consume8()); Sym.Signature = Data.consumeString(Strings); Sym.CompletionSnippetSuffix = Data.consumeString(Strings); Sym.Documentation = Data.consumeString(Strings); Index: clangd/test/CMakeLists.txt =================================================================== --- clangd/test/CMakeLists.txt +++ clangd/test/CMakeLists.txt @@ -8,6 +8,7 @@ if(CLANGD_BUILD_XPC) list(APPEND CLANGD_TEST_DEPS clangd-xpc-test-client) + list(APPEND CLANGD_TEST_DEPS ClangdXpcUnitTests) endif() foreach(dep FileCheck count not) Index: clangd/unittests/CMakeLists.txt =================================================================== --- clangd/unittests/CMakeLists.txt +++ clangd/unittests/CMakeLists.txt @@ -25,6 +25,7 @@ Annotations.cpp BackgroundIndexTests.cpp CancellationTests.cpp + CanonicalIncludesTests.cpp ClangdTests.cpp ClangdUnitTests.cpp CodeCompleteTests.cpp Index: clangd/unittests/CanonicalIncludesTests.cpp =================================================================== --- /dev/null +++ clangd/unittests/CanonicalIncludesTests.cpp @@ -0,0 +1,62 @@ +//===-- CanonicalIncludesTests.cpp - --------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "index/CanonicalIncludes.h" +#include "gtest/gtest.h" + +namespace clang { +namespace clangd { +namespace { + +TEST(CanonicalIncludesTest, CXXStandardLibrary) { + CanonicalIncludes CI; + addSystemHeadersMapping(&CI); + + // Usual standard library symbols are mapped correctly. + EXPECT_EQ("", CI.mapHeader("path/vector.h", "std::vector")); + // std::move is ambiguous, currently mapped only based on path + EXPECT_EQ("", CI.mapHeader("libstdc++/bits/move.h", "std::move")); + EXPECT_EQ("path/utility.h", CI.mapHeader("path/utility.h", "std::move")); + // Unknown std symbols aren't mapped. + EXPECT_EQ("foo/bar.h", CI.mapHeader("foo/bar.h", "std::notathing")); + // iosfwd declares some symbols it doesn't own. + EXPECT_EQ("", CI.mapHeader("iosfwd", "std::ostream")); + // And (for now) we assume it owns the others. + EXPECT_EQ("", CI.mapHeader("iosfwd", "std::notwathing")); +} + +TEST(CanonicalIncludesTest, PathMapping) { + // As used for IWYU pragmas. + CanonicalIncludes CI; + CI.addMapping("foo/bar", ""); + + EXPECT_EQ("", CI.mapHeader("foo/bar", "some::symbol")); + EXPECT_EQ("bar/bar", CI.mapHeader("bar/bar", "some::symbol")); +} + +TEST(CanonicalIncludesTest, SymbolMapping) { + // As used for standard library. + CanonicalIncludes CI; + CI.addSymbolMapping("some::symbol", ""); + + EXPECT_EQ("", CI.mapHeader("foo/bar", "some::symbol")); + EXPECT_EQ("foo/bar", CI.mapHeader("foo/bar", "other::symbol")); +} + +TEST(CanonicalIncludesTest, Precedence) { + CanonicalIncludes CI; + CI.addMapping("some/path", ""); + CI.addSymbolMapping("some::symbol", ""); + + // Symbol mapping beats path mapping. + EXPECT_EQ("", CI.mapHeader("some/path", "some::symbol")); +} + +} // namespace +} // namespace clangd +} // namespace clang Index: clangd/unittests/SerializationTests.cpp =================================================================== --- clangd/unittests/SerializationTests.cpp +++ clangd/unittests/SerializationTests.cpp @@ -40,8 +40,8 @@ End: Line: 1 Column: 1 -Origin: 4 -Flags: 1 +Origin: 128 +Flags: 129 Documentation: 'Foo doc' ReturnType: 'int' IncludeHeaders: @@ -115,7 +115,8 @@ EXPECT_EQ(Sym1.Documentation, "Foo doc"); EXPECT_EQ(Sym1.ReturnType, "int"); EXPECT_EQ(StringRef(Sym1.CanonicalDeclaration.FileURI), "file:///path/foo.h"); - EXPECT_EQ(Sym1.Origin, SymbolOrigin::Static); + EXPECT_EQ(Sym1.Origin, static_cast(1 << 7)); + EXPECT_EQ(static_cast(Sym1.Flags), 129); EXPECT_TRUE(Sym1.Flags & Symbol::IndexedForCodeCompletion); EXPECT_FALSE(Sym1.Flags & Symbol::Deprecated); EXPECT_THAT(Sym1.IncludeHeaders, Index: clangd/unittests/SymbolCollectorTests.cpp =================================================================== --- clangd/unittests/SymbolCollectorTests.cpp +++ clangd/unittests/SymbolCollectorTests.cpp @@ -931,47 +931,15 @@ UnorderedElementsAre(IncludeHeaderWithRef(TestHeaderURI, 1u))); } -#ifndef _WIN32 TEST_F(SymbolCollectorTest, CanonicalSTLHeader) { CollectorOpts.CollectIncludePath = true; CanonicalIncludes Includes; addSystemHeadersMapping(&Includes); CollectorOpts.Includes = &Includes; - // bits/basic_string.h$ should be mapped to - TestHeaderName = "/nasty/bits/basic_string.h"; - TestFileName = "/nasty/bits/basic_string.cpp"; - TestHeaderURI = URI::create(TestHeaderName).toString(); - runSymbolCollector("class string {};", /*Main=*/""); - EXPECT_THAT(Symbols, UnorderedElementsAre(AllOf(QName("string"), - DeclURI(TestHeaderURI), - IncludeHeader("")))); -} -#endif - -TEST_F(SymbolCollectorTest, STLiosfwd) { - CollectorOpts.CollectIncludePath = true; - CanonicalIncludes Includes; - addSystemHeadersMapping(&Includes); - CollectorOpts.Includes = &Includes; - // Symbols from should be mapped individually. - TestHeaderName = testPath("iosfwd"); - TestFileName = testPath("iosfwd.cpp"); - std::string Header = R"( - namespace std { - class no_map {}; - class ios {}; - class ostream {}; - class filebuf {}; - } // namespace std - )"; - runSymbolCollector(Header, /*Main=*/""); + runSymbolCollector("namespace std { class string {}; }", /*Main=*/""); EXPECT_THAT(Symbols, - UnorderedElementsAre( - QName("std"), - AllOf(QName("std::no_map"), IncludeHeader("")), - AllOf(QName("std::ios"), IncludeHeader("")), - AllOf(QName("std::ostream"), IncludeHeader("")), - AllOf(QName("std::filebuf"), IncludeHeader("")))); + Contains(AllOf(QName("std::string"), DeclURI(TestHeaderURI), + IncludeHeader("")))); } TEST_F(SymbolCollectorTest, IWYUPragma) { Index: clangd/unittests/xpc/CMakeLists.txt =================================================================== --- clangd/unittests/xpc/CMakeLists.txt +++ clangd/unittests/xpc/CMakeLists.txt @@ -8,7 +8,8 @@ ${CLANGD_SOURCE_DIR} ) -add_extra_unittest(ClangdXpcTests +add_custom_target(ClangdXpcUnitTests) +add_unittest(ClangdXpcUnitTests ClangdXpcTests ConversionTests.cpp )