pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/SqliteModernCpp/sqlite_modern_cpp/commit/c03e4e8293d050fa52898ad475a1f455a4ab3147

ossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-68dd150ce6c8e711.css" /> Add tests from string_view · SqliteModernCpp/sqlite_modern_cpp@c03e4e8 · GitHub
Skip to content

Commit c03e4e8

Browse files
committed
Add tests from string_view
1 parent 7d6ea22 commit c03e4e8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/string_view.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
#include <cstdlib>
3+
#include <sqlite_modern_cpp.h>
4+
#include <catch.hpp>
5+
6+
7+
#ifdef MODERN_SQLITE_STRINGVIEW_SUPPORT
8+
#include <string_view>
9+
10+
using namespace sqlite;
11+
using namespace std;
12+
TEST_CASE("std::string_view works", "[string_view]") {
13+
database db(":memory:");;
14+
db << "CREATE TABLE foo (a integer, b string);\n";
15+
const std::string_view test1 = "null terminated string view";
16+
db << "INSERT INTO foo VALUES (?, ?)" << 1 << test1;
17+
std::string str;
18+
db << "SELECT b from FOO where a=?;" << 1 >> str;
19+
REQUIRE(test1 == str);
20+
const char s[] = "hello world";
21+
std::string_view test2(&s[0], 2);
22+
db << "INSERT INTO foo VALUES (?,?)" << 2 << test2;
23+
db << "SELECT b from FOO where a=?" << 2 >> str;
24+
REQUIRE(str == "he");
25+
}
26+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy