mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 18:45:41 +00:00
Deploying to gh-pages from @ cf24f8971029f3bcabe398bb717f0051a0b1da49 🚀
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Source of the Rust file `db/db-core/src/tests.rs`."><title>tests.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-c4dbdcde0fbd8430.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-db279b6232be9c13.css"><link rel="stylesheet" disabled href="../../static.files/dark-cf923f49f397b216.css"><link rel="stylesheet" disabled href="../../static.files/ayu-be46fdc453a55015.css"><script src="../../static.files/storage-3891ce972e3a2bf8.js"></script><script defer src="../../static.files/source-script-1b95b7cca98b26e5.js"></script><script defer src="../../source-files.js"></script><script defer src="../../static.files/main-98a684e84ae5b08b.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><nav class="sub"><a class="sub-logo-container" href="../../db_core/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Source of the Rust file `db/db-core/src/tests.rs`."><title>tests.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ba5701c5741a7b69.css" id="mainThemeStyle"><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="db_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.70.0 (90c541806 2023-05-31)" data-search-js="search-e077946657036a58.js" data-settings-js="settings-298e1ea74db45b39.js" data-settings-css="settings-7bfb4c59cc6bc502.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ></div><script src="../../static.files/storage-62ce34ea385b278a.js"></script><script defer src="../../static.files/source-script-905937fbbdc8e9ea.js"></script><script defer src="../../source-files.js"></script><script defer src="../../static.files/main-f61008743c98d196.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><nav class="sub"><a class="sub-logo-container" href="../../db_core/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||
<a href="#2" id="2">2</a>
|
||||
<a href="#3" id="3">3</a>
|
||||
<a href="#4" id="4">4</a>
|
||||
@@ -296,7 +296,61 @@
|
||||
<a href="#296" id="296">296</a>
|
||||
<a href="#297" id="297">297</a>
|
||||
<a href="#298" id="298">298</a>
|
||||
</pre><pre class="rust"><code><span class="comment">/*
|
||||
<a href="#299" id="299">299</a>
|
||||
<a href="#300" id="300">300</a>
|
||||
<a href="#301" id="301">301</a>
|
||||
<a href="#302" id="302">302</a>
|
||||
<a href="#303" id="303">303</a>
|
||||
<a href="#304" id="304">304</a>
|
||||
<a href="#305" id="305">305</a>
|
||||
<a href="#306" id="306">306</a>
|
||||
<a href="#307" id="307">307</a>
|
||||
<a href="#308" id="308">308</a>
|
||||
<a href="#309" id="309">309</a>
|
||||
<a href="#310" id="310">310</a>
|
||||
<a href="#311" id="311">311</a>
|
||||
<a href="#312" id="312">312</a>
|
||||
<a href="#313" id="313">313</a>
|
||||
<a href="#314" id="314">314</a>
|
||||
<a href="#315" id="315">315</a>
|
||||
<a href="#316" id="316">316</a>
|
||||
<a href="#317" id="317">317</a>
|
||||
<a href="#318" id="318">318</a>
|
||||
<a href="#319" id="319">319</a>
|
||||
<a href="#320" id="320">320</a>
|
||||
<a href="#321" id="321">321</a>
|
||||
<a href="#322" id="322">322</a>
|
||||
<a href="#323" id="323">323</a>
|
||||
<a href="#324" id="324">324</a>
|
||||
<a href="#325" id="325">325</a>
|
||||
<a href="#326" id="326">326</a>
|
||||
<a href="#327" id="327">327</a>
|
||||
<a href="#328" id="328">328</a>
|
||||
<a href="#329" id="329">329</a>
|
||||
<a href="#330" id="330">330</a>
|
||||
<a href="#331" id="331">331</a>
|
||||
<a href="#332" id="332">332</a>
|
||||
<a href="#333" id="333">333</a>
|
||||
<a href="#334" id="334">334</a>
|
||||
<a href="#335" id="335">335</a>
|
||||
<a href="#336" id="336">336</a>
|
||||
<a href="#337" id="337">337</a>
|
||||
<a href="#338" id="338">338</a>
|
||||
<a href="#339" id="339">339</a>
|
||||
<a href="#340" id="340">340</a>
|
||||
<a href="#341" id="341">341</a>
|
||||
<a href="#342" id="342">342</a>
|
||||
<a href="#343" id="343">343</a>
|
||||
<a href="#344" id="344">344</a>
|
||||
<a href="#345" id="345">345</a>
|
||||
<a href="#346" id="346">346</a>
|
||||
<a href="#347" id="347">347</a>
|
||||
<a href="#348" id="348">348</a>
|
||||
<a href="#349" id="349">349</a>
|
||||
<a href="#350" id="350">350</a>
|
||||
<a href="#351" id="351">351</a>
|
||||
<a href="#352" id="352">352</a>
|
||||
</pre></div><pre class="rust"><code><span class="comment">/*
|
||||
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -558,7 +612,61 @@
|
||||
db.record_solve(c.key).<span class="kw">await</span>.unwrap();
|
||||
db.record_confirm(c.key).<span class="kw">await</span>.unwrap();
|
||||
|
||||
<span class="macro">assert_eq!</span>(db.fetch_solve(p.username, c.key).<span class="kw">await</span>.unwrap().len(), <span class="number">1</span>);
|
||||
<span class="comment">// analytics start
|
||||
|
||||
</span>db.analytics_create_psuedo_id_if_not_exists(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap();
|
||||
<span class="kw">let </span>psuedo_id = db
|
||||
.analytics_get_psuedo_id_from_capmaign_id(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap();
|
||||
db.analytics_create_psuedo_id_if_not_exists(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
psuedo_id,
|
||||
db.analytics_get_psuedo_id_from_capmaign_id(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap()
|
||||
);
|
||||
<span class="macro">assert_eq!</span>(
|
||||
c.key,
|
||||
db.analytics_get_capmaign_id_from_psuedo_id(<span class="kw-2">&</span>psuedo_id)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap()
|
||||
);
|
||||
|
||||
<span class="kw">let </span>analytics = CreatePerformanceAnalytics {
|
||||
time: <span class="number">0</span>,
|
||||
difficulty_factor: <span class="number">0</span>,
|
||||
worker_type: <span class="string">"wasm"</span>.into(),
|
||||
};
|
||||
db.analysis_save(c.key, <span class="kw-2">&</span>analytics).<span class="kw">await</span>.unwrap();
|
||||
<span class="kw">let </span>limit = <span class="number">50</span>;
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>offset = <span class="number">0</span>;
|
||||
<span class="kw">let </span>a = db.analytics_fetch(c.key, limit, offset).<span class="kw">await</span>.unwrap();
|
||||
<span class="macro">assert_eq!</span>(a[<span class="number">0</span>].time, analytics.time);
|
||||
<span class="macro">assert_eq!</span>(a[<span class="number">0</span>].difficulty_factor, analytics.difficulty_factor);
|
||||
<span class="macro">assert_eq!</span>(a[<span class="number">0</span>].worker_type, analytics.worker_type);
|
||||
offset += <span class="number">1</span>;
|
||||
<span class="macro">assert!</span>(db
|
||||
.analytics_fetch(c.key, limit, offset)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap()
|
||||
.is_empty());
|
||||
|
||||
db.analytics_delete_all_records_for_campaign(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap();
|
||||
<span class="macro">assert_eq!</span>(db.analytics_fetch(c.key, <span class="number">1000</span>, <span class="number">0</span>).<span class="kw">await</span>.unwrap().len(), <span class="number">0</span>);
|
||||
<span class="macro">assert!</span>(!db.analytics_captcha_is_published(c.key).<span class="kw">await</span>.unwrap());
|
||||
db.analytics_delete_all_records_for_campaign(c.key)
|
||||
.<span class="kw">await
|
||||
</span>.unwrap();
|
||||
<span class="comment">// analytics end
|
||||
|
||||
</span><span class="macro">assert_eq!</span>(db.fetch_solve(p.username, c.key).<span class="kw">await</span>.unwrap().len(), <span class="number">1</span>);
|
||||
<span class="macro">assert_eq!</span>(
|
||||
db.fetch_config_fetched(p.username, c.key)
|
||||
.<span class="kw">await
|
||||
@@ -594,5 +702,4 @@
|
||||
</span>db.delete_captcha(p.username, p.username).<span class="kw">await</span>.unwrap();
|
||||
<span class="macro">assert!</span>(!db.captcha_exists(<span class="prelude-val">Some</span>(p.username), c.key).<span class="kw">await</span>.unwrap());
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="db_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.69.0 (84c898d65 2023-04-16)" data-search-js="search-8a59a8356673ec1f.js" data-settings-js="settings-f0c5c39777a9a2f6.js" data-settings-css="settings-0bcba95ff279c1db.css" ></div></body></html>
|
||||
</code></pre></div></section></main></body></html>
|
||||
Reference in New Issue
Block a user