hexsha stringlengths 40 40 | size int64 32 998k | ext stringclasses 1
value | lang stringclasses 1
value | max_stars_repo_path stringlengths 6 206 | max_stars_repo_name stringlengths 6 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 6 | max_stars_count float64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 6 206 | max_issues_repo_name stringlengths 6 110 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 6 | max_issues_count float64 1 77k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 6 206 | max_forks_repo_name stringlengths 6 110 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 6 | max_forks_count float64 1 28.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 32 998k | avg_line_length float64 5.99 517 | max_line_length int64 15 222k | alphanum_fraction float64 0.05 0.98 | test_functions listlengths 1 633 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f70f1c6649514a77a7030b529b076cc0b9b7944d | 36,964 | rs | Rust | radeco-lib/src/backend/lang_c/c_cfg_builder.rs | MicrohexHQ/radeco | 0f1317e49cc43d4fbb2168ee51aa39ef4d09cf35 | [
"BSD-3-Clause"
] | null | null | null | radeco-lib/src/backend/lang_c/c_cfg_builder.rs | MicrohexHQ/radeco | 0f1317e49cc43d4fbb2168ee51aa39ef4d09cf35 | [
"BSD-3-Clause"
] | null | null | null | radeco-lib/src/backend/lang_c/c_cfg_builder.rs | MicrohexHQ/radeco | 0f1317e49cc43d4fbb2168ee51aa39ef4d09cf35 | [
"BSD-3-Clause"
] | null | null | null | //! This module is for recovering CCFG from RadecoFunction.
//!
//! Usage of this module is to call `c_cfg_builder::recover_simple_cfg(rfn)`
//! where `rfn` is an instance of `RadecoFunction`, the function returns an instance of
//! CCFG and we can obtain higher level representation than Radeco IR.
use super::c_ast;
u... | 36.274779 | 99 | 0.495347 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn c_cfg_data_map_test() {\n for file in FILES.iter() {\n let rfn = load(\"./test_files/bin1_main_ssa\");\n let mut datamap = CCFGDataMap::new(&rfn);\n let mut ccfg = c_cfg::CCFG::new(rfn.name.as_ref());\n ... |
f70f1cb6eb79176aec67a148809d9636bcda93e9 | 2,813 | rs | Rust | src/unserializers.rs | WaffleLapkin/serde-multipart | b7843fbd57abbdf6b725483facc63705556d33b5 | [
"MIT"
] | null | null | null | src/unserializers.rs | WaffleLapkin/serde-multipart | b7843fbd57abbdf6b725483facc63705556d33b5 | [
"MIT"
] | null | null | null | src/unserializers.rs | WaffleLapkin/serde-multipart | b7843fbd57abbdf6b725483facc63705556d33b5 | [
"MIT"
] | null | null | null | mod bytes;
mod input_file;
mod string;
pub(crate) use input_file::InputFileUnserializer;
use std::fmt::{self, Display};
use serde::ser;
#[derive(Debug, PartialEq, Eq)]
pub enum UnserializerError {
Custom(String),
UnsupportedType {
ty: &'static str,
supported: &'static str,
},
Unexpec... | 24.893805 | 74 | 0.529684 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test() {\n use crate::unserializers::string::StringUnserializer;\n use serde::Serialize;\n\n use crate::unserializers::input_file::InputFileUnserializer;\n use crate::InputFile;\n use std::borrow::Cow;\n\n let value = String::from(... |
f70f24b9e573cbd6b768be014cc0d48f7daf9a5e | 408 | rs | Rust | tests/class_test/constant_string_test.rs | linianhui/div | 22cb2756638a71d705c7000fff8a548185fc7846 | [
"MIT"
] | null | null | null | tests/class_test/constant_string_test.rs | linianhui/div | 22cb2756638a71d705c7000fff8a548185fc7846 | [
"MIT"
] | null | null | null | tests/class_test/constant_string_test.rs | linianhui/div | 22cb2756638a71d705c7000fff8a548185fc7846 | [
"MIT"
] | null | null | null | extern crate div;
use div::class::ConstantString;
use div::class::ConstantTag;
use div::class::U8Reader;
#[test]
fn test_constant_string() {
let mut u8_reader = U8Reader::new(&[0x00, 0x15]);
let constant_string = ConstantString::new(&mut u8_reader);
assert_eq!(ConstantTag::String, constant_string.tag);
... | 29.142857 | 62 | 0.72549 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_constant_string() {\n let mut u8_reader = U8Reader::new(&[0x00, 0x15]);\n let constant_string = ConstantString::new(&mut u8_reader);\n assert_eq!(ConstantTag::String, constant_string.tag);\n assert_eq!(21, constant_string.string_ind... |
f70f33cef56cdbd1562fc737e4d06e3195821a0a | 4,772 | rs | Rust | thoth-api/src/publication/model.rs | tosteiner/thoth | d0132d0460463e45ca07350a72271b82b215afcc | [
"Apache-2.0"
] | null | null | null | thoth-api/src/publication/model.rs | tosteiner/thoth | d0132d0460463e45ca07350a72271b82b215afcc | [
"Apache-2.0"
] | null | null | null | thoth-api/src/publication/model.rs | tosteiner/thoth | d0132d0460463e45ca07350a72271b82b215afcc | [
"Apache-2.0"
] | null | null | null | use serde::{Deserialize, Serialize};
use std::fmt;
use std::str::FromStr;
use uuid::Uuid;
use crate::errors::ThothError;
#[cfg(feature = "backend")]
use crate::schema::publication;
#[cfg_attr(feature = "backend", derive(DbEnum, juniper::GraphQLEnum))]
#[cfg_attr(feature = "backend", DieselType = "Publication_type")]
... | 30.394904 | 76 | 0.628877 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_publicationtype_default() {\n let pubtype: PublicationType = Default::default();\n assert_eq!(pubtype, PublicationType::Paperback);\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_publicationtype_display(... |
f70f424631bef5209e0f37ad2cf5f8fb1a006c1a | 24,406 | rs | Rust | src/lib.rs | j5ik2o/uild-generator-rs | 811f95e7901ba34cc666e6c079bf1416d71431bd | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 6 | 2021-06-27T16:03:15.000Z | 2022-01-22T12:05:48.000Z | src/lib.rs | j5ik2o/uild-generator-rs | 811f95e7901ba34cc666e6c079bf1416d71431bd | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2022-03-24T13:41:53.000Z | 2022-03-24T13:41:53.000Z | src/lib.rs | j5ik2o/ulid-generator-rs | 811f95e7901ba34cc666e6c079bf1416d71431bd | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2020 Developers of the `ulid-generator-rs` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, o... | 33.944367 | 117 | 0.633942 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn generate() -> Result<(), ULIDError> {\n let now = Local::now().timestamp_millis();\n let ulid = ULIDGenerator::new().generate()?;\n assert!(now <= ulid.to_epoch_milli_as_long());\n Ok(())\n }\n}",
"#[cfg(test)]\nmod tests {\n use s... |
f70f5d735a5e2deed09f55912b2dbd16f1b829a9 | 2,528 | rs | Rust | src/ngram.rs | ShigekiKarita/rust_nlp100 | ab310f131ba5cf4645d2b7574e8b11965d4e3eb3 | [
"BSL-1.0"
] | 4 | 2019-06-12T09:13:31.000Z | 2019-10-08T06:17:45.000Z | src/ngram.rs | ShigekiKarita/rust_nlp100 | ab310f131ba5cf4645d2b7574e8b11965d4e3eb3 | [
"BSL-1.0"
] | null | null | null | src/ngram.rs | ShigekiKarita/rust_nlp100 | ab310f131ba5cf4645d2b7574e8b11965d4e3eb3 | [
"BSL-1.0"
] | null | null | null | use std::collections::VecDeque;
pub struct NGramIter<T: Iterator> {
n: usize,
tokn: T,
prev: VecDeque<T::Item>,
init: bool
}
impl<T: Iterator> NGramIter<T>
where <T as Iterator>::Item: Clone {
pub fn from(s: T, n: usize) -> NGramIter<T> {
NGramIter { n: n, tokn: s, prev: VecDeque::new(), ... | 25.535354 | 71 | 0.525316 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_char_bigram() {\n let s = \"abc\";\n let mut ngram = s.chars().ngram(2);\n assert_eq!(Some(vec!['a', 'b']), ngram.next());\n assert_eq!(Some(vec!['b', 'c']), ngram.next());\n assert_eq!(None, ngram.next());\n}\n}",
"#[cfg(test... |
f70f6da49473d318adf735c44945c8ea9a8260e4 | 3,939 | rs | Rust | src/builtin/fiber.rs | sisshiki1969/ruruby | 51c993715115bc185942d0593bcebaf91b231027 | [
"MIT"
] | 317 | 2019-10-19T14:22:56.000Z | 2022-02-21T14:23:48.000Z | src/builtin/fiber.rs | sisshiki1969/ruruby | 51c993715115bc185942d0593bcebaf91b231027 | [
"MIT"
] | 9 | 2020-05-10T18:32:10.000Z | 2021-08-19T14:15:47.000Z | src/builtin/fiber.rs | sisshiki1969/ruruby | 51c993715115bc185942d0593bcebaf91b231027 | [
"MIT"
] | 11 | 2020-05-10T18:22:19.000Z | 2021-11-28T06:06:43.000Z | use crate::coroutine::*;
use crate::*;
pub fn init() -> Value {
let class = Module::class_under_object();
BuiltinClass::set_toplevel_constant("Fiber", class);
class.add_builtin_method_by_str("inspect", inspect);
class.add_builtin_method_by_str("resume", resume);
class.add_builtin_class_method("new... | 22.254237 | 71 | 0.501904 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fiber_test1() {\n let program = r#\"\n def enum2gen(enum)\n Fiber.new do\n enum.each{|i|\n Fiber.yield(i)\n }\n end\n end\n\n g = enum2gen(1..5)\n\n ... |
f70f8bc7ac2a90da1d16bf83292508557cc47805 | 13,999 | rs | Rust | components/tidb_query_datatype/src/codec/data_type/mod.rs | yuanguohuo/tikv | a4fcbfeea49eb30980de5f1d5d4e6212693e6420 | [
"Apache-2.0"
] | null | null | null | components/tidb_query_datatype/src/codec/data_type/mod.rs | yuanguohuo/tikv | a4fcbfeea49eb30980de5f1d5d4e6212693e6420 | [
"Apache-2.0"
] | null | null | null | components/tidb_query_datatype/src/codec/data_type/mod.rs | yuanguohuo/tikv | a4fcbfeea49eb30980de5f1d5d4e6212693e6420 | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
mod not_chunked_vec;
mod scalar;
mod vector;
// Concrete eval types without a nullable wrapper.
pub type Int = i64;
pub type Real = ordered_float::NotNan<f64>;
pub type Bytes = Vec<u8>;
pub type BytesRef<'a> = &'a [u8];
pub use crate::codec::mysql::{j... | 28.627812 | 98 | 0.565826 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_bytes_as_bool() {\n let tests: Vec<(&'static [u8], Option<bool>)> = vec![\n (b\"\", Some(false)),\n (b\" 23\", Some(true)),\n (b\"-1\", Some(true)),\n (b\"1.11\", Some(true)),\n (b\"... |
f70fbc368b2ed3f00cbe45cc4e11f5fb304485e5 | 559 | rs | Rust | exercises/test4.rs | InfiniteXyy/rustlings | eac7177a8d78ab26902f68b32185ce8802f4d94d | [
"MIT"
] | null | null | null | exercises/test4.rs | InfiniteXyy/rustlings | eac7177a8d78ab26902f68b32185ce8802f4d94d | [
"MIT"
] | null | null | null | exercises/test4.rs | InfiniteXyy/rustlings | eac7177a8d78ab26902f68b32185ce8802f4d94d | [
"MIT"
] | null | null | null | // test4.rs
// This test covers the sections:
// - Modules
// - Macros
// Write a macro that passes the test! No hints this time, you can do it!
mod macros {
#[macro_export]
macro_rules! my_macro {
($name:expr) => {
format!("Hello {}", $name)
};
}
}
#[cfg(test)]
mod tests {
... | 17.46875 | 73 | 0.543828 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_my_macro_world() {\n assert_eq!(my_macro!(\"world!\"), \"Hello world!\");\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_my_macro_goodbye() {\n assert_eq!(my_macro!(\"goodbye!\"), \"Hello goo... |
f70fc7f9d25762ed654af43a71aa7368d86383b2 | 4,854 | rs | Rust | src/bloom_filter.rs | DennisOSRM/toolbox-rs | 3928b4e43a719b130ca530c4e5436c404a802eb5 | [
"MIT"
] | 6 | 2022-03-25T09:37:53.000Z | 2022-03-25T10:42:58.000Z | src/bloom_filter.rs | DennisOSRM/toolbox | 3db7cbe378b62a067b8c1dda0798a07ba435c096 | [
"MIT"
] | null | null | null | src/bloom_filter.rs | DennisOSRM/toolbox | 3db7cbe378b62a067b8c1dda0798a07ba435c096 | [
"MIT"
] | null | null | null | use bitvec::prelude::*;
use xxhash_rust::xxh3::xxh3_64_with_seed;
/// Straight-forward implementation of a bloom filter on u8 slices. It applies
/// the result of Kirsch and Mitzenmacher [1] of using a simple linear
/// combination of two hash functions without any loss in the asymptotic false
/// positive rate.
/// [... | 33.246575 | 95 | 0.620519 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn one_sentence() {\n let sentence1 = \"this is just a string of words with little meaning.\";\n let sentence2 = \"and this is another one with equally little meaning.\";\n\n let mut filter = BloomFilter::new_from_size_and_probabil... |
f70ffd1afe3a067742223b7bbf658068fc06a759 | 2,538 | rs | Rust | src/eventsub/user/update.rs | naumazeredo/twitch_api2 | 5848b08e3c6cf3b3ccfaa62a88c184782d960d2f | [
"Apache-2.0",
"MIT"
] | null | null | null | src/eventsub/user/update.rs | naumazeredo/twitch_api2 | 5848b08e3c6cf3b3ccfaa62a88c184782d960d2f | [
"Apache-2.0",
"MIT"
] | null | null | null | src/eventsub/user/update.rs | naumazeredo/twitch_api2 | 5848b08e3c6cf3b3ccfaa62a88c184782d960d2f | [
"Apache-2.0",
"MIT"
] | null | null | null | #![doc(alias = "user.update")]
//! Specified user updates their account.
use super::*;
/// [`user.update`](https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#userupdate): user updates their account.
#[derive(Clone, Debug, typed_builder::TypedBuilder, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(featu... | 33.84 | 132 | 0.611111 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn parse_payload() {\n let payload = r#\"\n {\n \"subscription\": {\n \"id\": \"f1c2a387-161a-49f9-a165-0f21d7a4e1c4\",\n \"type\": \"user.update\",\n \"version\": \"1\",\n \"status\": \"enabled\... |
f71034a12d79f4c015c0550fd3cdd88b737f57fd | 415 | rs | Rust | integration_tests/tests/workspaces.rs | ksamykandil/rusoto | ad6cd47833c45a8474b5df715abb03b4bf5a0f4c | [
"MIT"
] | null | null | null | integration_tests/tests/workspaces.rs | ksamykandil/rusoto | ad6cd47833c45a8474b5df715abb03b4bf5a0f4c | [
"MIT"
] | null | null | null | integration_tests/tests/workspaces.rs | ksamykandil/rusoto | ad6cd47833c45a8474b5df715abb03b4bf5a0f4c | [
"MIT"
] | 1 | 2021-09-24T08:34:02.000Z | 2021-09-24T08:34:02.000Z | #![cfg(feature = "workspaces")]
extern crate rusoto_core;
extern crate rusoto_workspaces;
use rusoto_workspaces::{Workspaces, WorkspacesClient, DescribeWorkspacesRequest};
use rusoto_core::Region;
#[test]
fn should_describe_workspaces() {
let client = WorkspacesClient::new(Region::UsEast1);
let request = Des... | 25.9375 | 81 | 0.766265 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn should_describe_workspaces() {\n let client = WorkspacesClient::new(Region::UsEast1);\n let request = DescribeWorkspacesRequest::default();\n\n client.describe_workspaces(request).sync().unwrap();\n}\n}"
] |
f7105951296724c550c2733c7571fb4d025ceee4 | 118,020 | rs | Rust | src/libsyntax/print/pprust.rs | tie-rack/rust | acf4e0be22203213a5e42469deea4dc6e49da840 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libsyntax/print/pprust.rs | tie-rack/rust | acf4e0be22203213a5e42469deea4dc6e49da840 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libsyntax/print/pprust.rs | tie-rack/rust | acf4e0be22203213a5e42469deea4dc6e49da840 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 36.950532 | 98 | 0.438205 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_fun_to_string() {\n let abba_ident = token::str_to_ident(\"abba\");\n\n let decl = ast::FnDecl {\n inputs: Vec::new(),\n output: ast::DefaultReturn(codemap::DUMMY_SP),\n variadic: false\n };... |
f710601c1ab38371bccdba2aac557971faa8c036 | 2,184 | rs | Rust | src/structs/enumerate.rs | AndWass/pushgen | 148fcc196cae2b98372c638f7c2096faf568389b | [
"Apache-2.0",
"MIT"
] | 23 | 2021-06-29T14:53:24.000Z | 2021-07-07T10:42:29.000Z | src/structs/enumerate.rs | AndWass/pushgen | 148fcc196cae2b98372c638f7c2096faf568389b | [
"Apache-2.0",
"MIT"
] | 53 | 2021-07-05T10:13:59.000Z | 2021-08-21T11:19:37.000Z | src/structs/enumerate.rs | AndWass/pushgen | 148fcc196cae2b98372c638f7c2096faf568389b | [
"Apache-2.0",
"MIT"
] | 4 | 2021-07-02T09:14:45.000Z | 2021-07-08T04:47:24.000Z | use crate::{Generator, GeneratorResult, ValueResult};
use core::num::NonZeroUsize;
/// A generator that yields the current count and the value when run. See [`enumerate()`](crate::GeneratorExt::enumerate) for details.
pub struct Enumerate<Src> {
source: Src,
index: usize,
}
impl<Src> Enumerate<Src> {
#[in... | 27.64557 | 134 | 0.56685 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn enumerate() {\n let data = ['a', 'b', 'c'];\n\n let mut gen = SliceGenerator::new(&data).enumerate();\n assert_eq!(gen.next(), Ok((0, &'a')));\n assert_eq!(gen.next(), Ok((1, &'b')));\n assert_eq!(gen.next(), Ok((2... |
f7106a3ed4b23093d6e85b2298d1c1cf024bb4d2 | 3,245 | rs | Rust | sync/src/relayer/tests/reconstruct_block.rs | LeastAuthority/nervos-ckb | 8a28087e38efd5efd226393193392d07912c7c39 | [
"MIT"
] | null | null | null | sync/src/relayer/tests/reconstruct_block.rs | LeastAuthority/nervos-ckb | 8a28087e38efd5efd226393193392d07912c7c39 | [
"MIT"
] | null | null | null | sync/src/relayer/tests/reconstruct_block.rs | LeastAuthority/nervos-ckb | 8a28087e38efd5efd226393193392d07912c7c39 | [
"MIT"
] | null | null | null | use super::helper::{build_chain, new_transaction};
use crate::relayer::ReconstructionError;
use ckb_types::prelude::*;
use ckb_types::{
core::TransactionView,
packed,
packed::{BlockBuilder, CompactBlockBuilder},
};
use std::collections::HashSet;
// There are more test cases in block_transactions_process an... | 37.298851 | 99 | 0.604931 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_reconstruct_block() {\n let (relayer, always_success_out_point) = build_chain(5);\n let prepare: Vec<TransactionView> = (0..20)\n .map(|i| new_transaction(&relayer, i, &always_success_out_point))\n .collect();\n\n // Case... |
f7108c3475b4f3776c5d6cd8f13c88c492edf669 | 14,048 | rs | Rust | ffi/src/lib.rs | kornstar11/wirefilter | bad68d2ce89f142651280515b56d2ce5cfa79641 | [
"MIT"
] | 1 | 2020-10-23T23:59:36.000Z | 2020-10-23T23:59:36.000Z | ffi/src/lib.rs | kornstar11/wirefilter | bad68d2ce89f142651280515b56d2ce5cfa79641 | [
"MIT"
] | 1 | 2020-09-08T17:49:12.000Z | 2020-09-08T17:49:12.000Z | ffi/src/lib.rs | kornstar11/wirefilter | bad68d2ce89f142651280515b56d2ce5cfa79641 | [
"MIT"
] | null | null | null | pub mod transfer_types;
use crate::transfer_types::{
ExternallyAllocatedByteArr, ExternallyAllocatedStr, RustAllocatedString, RustBox,
StaticRustAllocatedString,
};
use fnv::FnvHasher;
use std::{
hash::Hasher,
io::{self, Write},
net::IpAddr,
};
use wirefilter::{ExecutionContext, Filter, FilterAst, ... | 27.119691 | 125 | 0.571398 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn parse_error() {\n use indoc::indoc;\n\n let src = indoc!(\n r#\"\n (\n num1 == 42\n or\n num1 == \"abc\"\n )\n \"#\n );\n\n let sche... |
f710a6bcce86addc09a402b4a9987bd13bd0f7bc | 4,365 | rs | Rust | modules/src/clients/ics07_tendermint/consensus_state.rs | deuszx/ibc-rs | 499156fac515ab087cf0d31a55d78120f9e0c8cb | [
"Apache-2.0"
] | 1 | 2020-02-24T14:58:38.000Z | 2020-02-24T14:58:38.000Z | modules/src/clients/ics07_tendermint/consensus_state.rs | deuszx/ibc-rs | 499156fac515ab087cf0d31a55d78120f9e0c8cb | [
"Apache-2.0"
] | null | null | null | modules/src/clients/ics07_tendermint/consensus_state.rs | deuszx/ibc-rs | 499156fac515ab087cf0d31a55d78120f9e0c8cb | [
"Apache-2.0"
] | null | null | null | use crate::prelude::*;
use core::convert::Infallible;
use serde::Serialize;
use tendermint::{hash::Algorithm, time::Time, Hash};
use tendermint_proto::google::protobuf as tpb;
use tendermint_proto::Protobuf;
use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawConsensusState;
use crate::clients::i... | 32.095588 | 99 | 0.644903 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn serialization_roundtrip_no_proof() {\n let json_data =\n include_str!(\"../../../tests/support/query/serialization/consensus_state.json\");\n test_serialization_roundtrip::<AbciQuery>(json_data);\n }\n}",
"#[cfg(test)]\... |
f710a6da59bd7ab87e1eaedd96cb815323c9fc61 | 5,761 | rs | Rust | src/libstd/sync/one.rs | quornian/rust | dbc379a66eae8504b663b0032da518595335d872 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libstd/sync/one.rs | quornian/rust | dbc379a66eae8504b663b0032da518595335d872 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libstd/sync/one.rs | quornian/rust | dbc379a66eae8504b663b0032da518595335d872 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | 33.690058 | 80 | 0.59087 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn smoke_once() {\n static O: Once = ONCE_INIT;\n let mut a = 0i;\n O.doit(|| a += 1);\n assert_eq!(a, 1);\n O.doit(|| a += 1);\n assert_eq!(a, 1);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n ... |
f710afe63139ff8c445c2cfe19d5c6d8958cff63 | 10,528 | rs | Rust | src/transport/smtp/commands.rs | manuelpelloni/lettre | 60e3a0b7cbb33ded86468930b2ec1be817c53f9e | [
"MIT"
] | null | null | null | src/transport/smtp/commands.rs | manuelpelloni/lettre | 60e3a0b7cbb33ded86468930b2ec1be817c53f9e | [
"MIT"
] | null | null | null | src/transport/smtp/commands.rs | manuelpelloni/lettre | 60e3a0b7cbb33ded86468930b2ec1be817c53f9e | [
"MIT"
] | null | null | null | //! SMTP commands
use crate::{
transport::smtp::{
authentication::{Credentials, Mechanism},
error::Error,
extension::{ClientId, MailParameter, RcptParameter},
response::Response,
},
Address,
};
#[cfg(feature = "log")]
use log::debug;
use std::{
convert::AsRef,
fmt::{... | 27.488251 | 97 | 0.549012 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_display() {\n let id = ClientId::Domain(\"localhost\".to_string());\n let email = Address::from_str(\"test@example.com\").unwrap();\n let mail_parameter = MailParameter::Other {\n keyword: \"TEST\".to_string(),\n... |
f710bf115b7524b7ddff11de4c2e731e772f39df | 2,120 | rs | Rust | consensus/src/chained_bft/proto_test.rs | pdhamdhere/libra | 477aa75dfb3c7b66003a5a8e33cf50af19c4bed3 | [
"Apache-2.0"
] | 3 | 2019-07-19T12:03:10.000Z | 2019-09-28T08:38:24.000Z | consensus/src/chained_bft/proto_test.rs | pdhamdhere/libra | 477aa75dfb3c7b66003a5a8e33cf50af19c4bed3 | [
"Apache-2.0"
] | null | null | null | consensus/src/chained_bft/proto_test.rs | pdhamdhere/libra | 477aa75dfb3c7b66003a5a8e33cf50af19c4bed3 | [
"Apache-2.0"
] | 1 | 2019-09-08T21:03:52.000Z | 2019-09-08T21:03:52.000Z | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
chained_bft::{
consensus_types::{
block::Block,
proposal_msg::{ProposalMsg, ProposalUncheckedSignatures},
quorum_cert::QuorumCert,
sync_info::SyncInfo,
... | 28.266667 | 93 | 0.620755 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_proto_convert_block() {\n let block: Block<u64> = Block::make_genesis_block();\n assert_protobuf_encode_decode(&block);\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_proto_convert_proposal() {\n let ... |
f710f799fe2dbc261224ced61d3603f896ea4c68 | 50,148 | rs | Rust | packages/std/src/math/decimal.rs | kitounliu/cosmwasm | e44e10dcd4886b2295432a552d931928a43270d3 | [
"Apache-2.0"
] | null | null | null | packages/std/src/math/decimal.rs | kitounliu/cosmwasm | e44e10dcd4886b2295432a552d931928a43270d3 | [
"Apache-2.0"
] | null | null | null | packages/std/src/math/decimal.rs | kitounliu/cosmwasm | e44e10dcd4886b2295432a552d931928a43270d3 | [
"Apache-2.0"
] | null | null | null | use forward_ref::{forward_ref_binop, forward_ref_op_assign};
use schemars::JsonSchema;
use serde::{de, ser, Deserialize, Deserializer, Serialize};
use std::cmp::Ordering;
use std::convert::TryInto;
use std::fmt::{self, Write};
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, Sub, SubAssign};
use std::str::FromStr;
u... | 34.776699 | 131 | 0.561059 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn decimal_one() {\n let value = Decimal::one();\n assert_eq!(value.0, Decimal::DECIMAL_FRACTIONAL);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn decimal_zero() {\n let value = Decimal::zero();\n... |
f7110343a02a1e5896bea4781cd4dc92c53eddbd | 788 | rs | Rust | lumen_runtime/src/otp/erlang/is_atom_1/test.rs | xtian/lumen | 20a3095697ce05c860f825ae573fa4e70e740026 | [
"Apache-2.0"
] | 25 | 2020-01-24T15:21:31.000Z | 2021-06-12T00:08:07.000Z | lumen_runtime/src/otp/erlang/is_atom_1/test.rs | xtian/lumen | 20a3095697ce05c860f825ae573fa4e70e740026 | [
"Apache-2.0"
] | null | null | null | lumen_runtime/src/otp/erlang/is_atom_1/test.rs | xtian/lumen | 20a3095697ce05c860f825ae573fa4e70e740026 | [
"Apache-2.0"
] | null | null | null | use proptest::prop_assert_eq;
use proptest::test_runner::{Config, TestRunner};
use crate::otp::erlang::is_atom_1::native;
use crate::scheduler::with_process_arc;
use crate::test::strategy;
#[test]
fn without_atom_returns_false() {
with_process_arc(|arc_process| {
TestRunner::new(Config::with_source_file(f... | 25.419355 | 76 | 0.587563 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn without_atom_returns_false() {\n with_process_arc(|arc_process| {\n TestRunner::new(Config::with_source_file(file!()))\n .run(&strategy::term::is_not_atom(arc_process.clone()), |term| {\n prop_assert_eq!(native(te... |
f711078b0ed7fbe399c56d4cbe3584119c2a99d2 | 4,251 | rs | Rust | src/global_functions.rs | alexgnatrow/tera | 1a483b510d0b621c250793413679992105a89aa2 | [
"MIT"
] | 1 | 2017-06-22T12:55:52.000Z | 2017-06-22T12:55:52.000Z | src/global_functions.rs | alexgnatrow/tera | 1a483b510d0b621c250793413679992105a89aa2 | [
"MIT"
] | null | null | null | src/global_functions.rs | alexgnatrow/tera | 1a483b510d0b621c250793413679992105a89aa2 | [
"MIT"
] | 2 | 2019-02-07T08:52:38.000Z | 2019-02-07T09:08:29.000Z | use std::collections::HashMap;
use serde_json::value::{Value, to_value, from_value};
use errors::Result;
/// The global function type definition
pub type GlobalFn = Box<Fn(HashMap<String, Value>) -> Result<Value> + Sync + Send>;
pub fn make_range_fn() -> GlobalFn {
Box::new(move |args| -> Result<Value> {
... | 31.723881 | 111 | 0.52223 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_range_default() {\n let mut args = HashMap::new();\n args.insert(\"end\".to_string(), to_value(5).unwrap());\n\n let res = make_range_fn()(args).unwrap();\n assert_eq!(res, to_value(vec![0,1,2,3,4]).unwrap());\n }... |
f711344ddf76c44710c695ca0607406c6589bab1 | 6,433 | rs | Rust | rpass_db/src/callbacks/confirm_login.rs | Arjentix/rpass | 9c9df38de844612f2b61a4f66229e1400a99aac5 | [
"MIT"
] | null | null | null | rpass_db/src/callbacks/confirm_login.rs | Arjentix/rpass | 9c9df38de844612f2b61a4f66229e1400a99aac5 | [
"MIT"
] | 7 | 2022-01-27T21:03:58.000Z | 2022-03-27T18:36:48.000Z | rpass_db/src/callbacks/confirm_login.rs | Arjentix/rpass | 9c9df38de844612f2b61a4f66229e1400a99aac5 | [
"MIT"
] | null | null | null | use super::{session::*, ArgIter, AsyncStorage, Error, Result};
/// Second and final part of user logging. Reads encrypted confirmation string
/// from `arg_iter`, decrypts it with `storage.sec_key` and checks if it is
/// equal to the *login_confirmation* in session.
///
/// If everything is good then:
/// 1. Sets `se... | 36.140449 | 93 | 0.619462 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_ok() {\n let mock_storage = AsyncStorage::default();\n let mut session = Session::Unauthorized(Unauthorized {\n username: TEST_USER.to_owned(),\n login_confirmation: String::from(\"confirmation\"),\n }... |
f711426c7786278ea1e90850edc641a4f1af1be9 | 14,683 | rs | Rust | src/room/power_levels.rs | NerdyPepper/ruma-events | 663407917211862e7ee0175cce9aaa64256395c5 | [
"MIT"
] | null | null | null | src/room/power_levels.rs | NerdyPepper/ruma-events | 663407917211862e7ee0175cce9aaa64256395c5 | [
"MIT"
] | null | null | null | src/room/power_levels.rs | NerdyPepper/ruma-events | 663407917211862e7ee0175cce9aaa64256395c5 | [
"MIT"
] | null | null | null | //! Types for the *m.room.power_levels* event.
use std::collections::HashMap;
use js_int::{Int, UInt};
use ruma_identifiers::{EventId, RoomId, UserId};
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
use serde_json::{Map, Value};
use crate::{Event as _, EventType, FromRaw};
/// Defines the po... | 32.058952 | 99 | 0.571954 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn serialization_with_optional_fields_as_none() {\n let default = default_power_level();\n\n let power_levels_event = PowerLevelsEvent {\n content: PowerLevelsEventContent {\n ban: default,\n event... |
f71169c10475aa8086e9014f5ac32cc67b08d9e6 | 25,034 | rs | Rust | tests/widgets_table.rs | oreksu/tui-rs | ce04c24221a7af92014619ebad0b363b351761a3 | [
"MIT"
] | 1 | 2020-11-05T17:20:16.000Z | 2020-11-05T17:20:16.000Z | tests/widgets_table.rs | oreksu/tui-rs | ce04c24221a7af92014619ebad0b363b351761a3 | [
"MIT"
] | null | null | null | tests/widgets_table.rs | oreksu/tui-rs | ce04c24221a7af92014619ebad0b363b351761a3 | [
"MIT"
] | 1 | 2021-11-28T11:21:13.000Z | 2021-11-28T11:21:13.000Z | use tui::{
backend::TestBackend,
buffer::Buffer,
layout::Constraint,
style::{Color, Modifier, Style},
text::{Span, Spans},
widgets::{Block, Borders, Cell, Row, Table, TableState},
Terminal,
};
#[test]
fn widgets_table_column_spacing_can_be_changed() {
let test_case = |column_spacing, ex... | 34.866295 | 99 | 0.327395 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn widgets_table_column_spacing_can_be_changed() {\n let test_case = |column_spacing, expected| {\n let backend = TestBackend::new(30, 10);\n let mut terminal = Terminal::new(backend).unwrap();\n\n terminal\n .draw(|f... |
f7117f9472bdd2f6872fb5310a9540c8c0e3a122 | 9,994 | rs | Rust | skia-safe/src/core/color.rs | romanzes/rust-skia | 4383385e6f51eb51f059d20077ab1c7c6e1fde84 | [
"MIT"
] | null | null | null | skia-safe/src/core/color.rs | romanzes/rust-skia | 4383385e6f51eb51f059d20077ab1c7c6e1fde84 | [
"MIT"
] | null | null | null | skia-safe/src/core/color.rs | romanzes/rust-skia | 4383385e6f51eb51f059d20077ab1c7c6e1fde84 | [
"MIT"
] | null | null | null | use crate::prelude::*;
use crate::u8cpu;
use skia_bindings as sb;
use skia_bindings::{SkColor, SkColor4f, SkHSVToColor, SkPMColor, SkRGBToHSV};
use std::ops::{BitAnd, BitOr, Index, IndexMut, Mul};
// TODO: What should we do with SkAlpha?
// It does not seem to be used, but if we want to export it, we'd
// like... | 25.625641 | 101 | 0.525115 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_color_layout() {\r\n Color::test_layout();\r\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn color_channel_naming() {\r\n let _ = ColorChannel::R;\r\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n ... |
f711839cc6593f8ec5984cae5a64b2fbd48baa44 | 1,418 | rs | Rust | src/p986_binary_tree_cameras.rs | sethbywater/leetcode | 0c855077c0f8c417d9d65eb3d4aa67d9fe487f06 | [
"MIT"
] | null | null | null | src/p986_binary_tree_cameras.rs | sethbywater/leetcode | 0c855077c0f8c417d9d65eb3d4aa67d9fe487f06 | [
"MIT"
] | null | null | null | src/p986_binary_tree_cameras.rs | sethbywater/leetcode | 0c855077c0f8c417d9d65eb3d4aa67d9fe487f06 | [
"MIT"
] | null | null | null | //! # 986. Binary tree cameras
//!
//! Given the root of a binary tree, you may install cameras a any node
//! to monitor all adjacent nodes. Return the minimum number of cameras
//! required to monitor all nodes
use std::{cell::RefCell, rc::Rc};
use crate::collections::TreeNode;
pub fn min_camera_cover(root: Option<... | 26.259259 | 89 | 0.631876 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn example_1() {\n\tlet root = TreeNode::root_from_slice(&[\n\t\tSome(0), Some(0), Some(0), None, None, Some(0), None, None, None\n\t]);\n\tassert_eq!(min_camera_cover(root), 1);\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n ... |
f71190da4301172d4a909389374e004adbad0b07 | 24,759 | rs | Rust | src/libsyntax/parse/token.rs | P1start/rust | d64b4103d688f38c2e9e2daf966d50beeb383f1e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1 | 2018-02-17T14:37:31.000Z | 2018-02-17T14:37:31.000Z | src/libsyntax/parse/token.rs | P1start/rust | d64b4103d688f38c2e9e2daf966d50beeb383f1e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libsyntax/parse/token.rs | P1start/rust | d64b4103d688f38c2e9e2daf966d50beeb383f1e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 31.420051 | 97 | 0.512379 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn mtwt_token_eq_test() {\n assert!(mtwt_token_eq(>,>));\n let a = str_to_ident(\"bac\");\n let a1 = mark_ident(a,92);\n assert!(mtwt_token_eq(&IDENT(a,true),&IDENT(a1,false)));\n }\n}"
] |
f7119860fe4014e38f761ba9fdb466d2242a0fca | 16,466 | rs | Rust | src/parser.rs | firestack/parrot | 66e2da3612e062831142b017ed636a2f4f912a23 | [
"MIT"
] | 4 | 2020-09-13T11:18:02.000Z | 2021-09-08T20:34:20.000Z | src/parser.rs | firestack/parrot | 66e2da3612e062831142b017ed636a2f4f912a23 | [
"MIT"
] | 5 | 2020-09-13T10:18:21.000Z | 2021-01-31T16:50:12.000Z | src/parser.rs | firestack/parrot | 66e2da3612e062831142b017ed636a2f4f912a23 | [
"MIT"
] | 2 | 2021-09-08T20:35:27.000Z | 2021-09-16T04:57:22.000Z | use nom::branch::alt;
use nom::bytes::complete::{tag, take_while, take_while1};
use nom::character::complete::one_of;
use nom::combinator::{map, peek, value};
use nom::sequence::{preceded, terminated};
use nom::IResult;
#[derive(Debug, Eq, PartialEq, Clone)]
enum CommandKeyword {
Quit,
Clear,
Help,
Edi... | 35.487069 | 115 | 0.544152 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_no_args_left() {\n let cmd = Command::Quit;\n let error = Err(Error::custom(ErrorKind::TooManyArguments(cmd.clone())));\n\n // Should succeed\n assert_eq!(no_args_left(\"\", cmd.clone()), Ok((\"\", cmd.clone())));\n ... |
f711b0828cca69f3047cc635ed14bdaeaee8512c | 9,282 | rs | Rust | language/move-ir-compiler/src/unit_tests/branch_tests.rs | diem-fi/diem | 13a8f8cc650a7f024db68db9539097a154d46a26 | [
"Apache-2.0"
] | 2 | 2021-02-05T10:23:50.000Z | 2022-03-17T03:11:36.000Z | language/move-ir-compiler/src/unit_tests/branch_tests.rs | diem-fi/diem | 13a8f8cc650a7f024db68db9539097a154d46a26 | [
"Apache-2.0"
] | 492 | 2020-12-18T23:54:16.000Z | 2022-03-31T03:04:24.000Z | language/move-ir-compiler/src/unit_tests/branch_tests.rs | diem-fi/diem | 13a8f8cc650a7f024db68db9539097a154d46a26 | [
"Apache-2.0"
] | 1 | 2022-03-17T03:11:37.000Z | 2022-03-17T03:11:37.000Z | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::unit_tests::testutils::compile_script_string;
use move_binary_format::file_format::Bytecode::*;
#[test]
fn compile_if_else_with_fallthrough() {
let code = String::from(
"
main() {
let x: u64;
... | 25.086486 | 61 | 0.542555 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn compile_if_else_with_fallthrough() {\n let code = String::from(\n \"\n main() {\n let x: u64;\n label b0:\n jump_if (42 > 0) b2;\n label b1:\n x = 1;\n label b2:\n ret... |
f711dd66b706ed961e2f64d8b75fa96cff153f43 | 7,337 | rs | Rust | src/duo/difference_by_key.rs | MarinPostma/sdset | 3aa1e37d6a7069e7c8c81fb6699285522712a5fd | [
"MIT"
] | null | null | null | src/duo/difference_by_key.rs | MarinPostma/sdset | 3aa1e37d6a7069e7c8c81fb6699285522712a5fd | [
"MIT"
] | null | null | null | src/duo/difference_by_key.rs | MarinPostma/sdset | 3aa1e37d6a7069e7c8c81fb6699285522712a5fd | [
"MIT"
] | null | null | null | use crate::set::Set;
use crate::{exponential_offset_ge_by_key, SetOperation, Collection};
/// Represent the _difference_ set operation that will be applied to two slices of different types.
///
/// # Examples
/// ```
/// # use sdset::Error;
/// # fn try_main() -> Result<(), Error> {
/// use sdset::duo::OpBuilderByKey;... | 27.174074 | 99 | 0.453046 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn difference_empty_no_duplicates() {\n let a = Set::new_unchecked(&[\n Foo{ a: 1, b: 8 },\n Foo{ a: 2, b: 9 },\n Foo{ a: 3, b: 10 },\n Foo{ a: 4, b: 11 },\n Foo{ a: 5, b: 12 },\n ]);... |
f711ef719ecc210906470793b13c60ca0550d088 | 18,418 | rs | Rust | core/src/nodes/listeners.rs | michaelvoronov/rust-libp2p | d50130e382573db66e966a63a74bf26c7d0e04e5 | [
"MIT"
] | null | null | null | core/src/nodes/listeners.rs | michaelvoronov/rust-libp2p | d50130e382573db66e966a63a74bf26c7d0e04e5 | [
"MIT"
] | null | null | null | core/src/nodes/listeners.rs | michaelvoronov/rust-libp2p | d50130e382573db66e966a63a74bf26c7d0e04e5 | [
"MIT"
] | null | null | null | // Copyright 2018 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, mer... | 38.29106 | 134 | 0.565968 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn incoming_event() {\n async_std::task::block_on(async move {\n let mem_transport = transport::MemoryTransport::default();\n\n let mut listeners = ListenersStream::new(mem_transport);\n listeners.listen_on(\"/me... |
f7120d78f11a512d2d4cf48fe26fcbc7ac29edce | 353 | rs | Rust | src/cargonauts-config/src/tests.rs | cargonauts-rs/cargonauts | 51d155bac23a3fa2483b3b6987beee25d978601b | [
"Apache-2.0",
"MIT"
] | 185 | 2017-06-01T18:39:32.000Z | 2022-01-22T11:28:40.000Z | src/cargonauts-config/src/tests.rs | cargonauts-rs/cargonauts | 51d155bac23a3fa2483b3b6987beee25d978601b | [
"Apache-2.0",
"MIT"
] | 12 | 2017-05-29T07:27:40.000Z | 2017-08-14T05:33:51.000Z | src/cargonauts-config/src/tests.rs | cargonauts-rs/cargonauts | 51d155bac23a3fa2483b3b6987beee25d978601b | [
"Apache-2.0",
"MIT"
] | 11 | 2017-05-31T05:33:50.000Z | 2022-01-28T19:23:57.000Z | use CargonautsConfig;
#[test]
fn toml_ctor() {
assert!(CargonautsConfig::from_toml("[package.metadata.cargonauts]").is_ok())
}
#[test]
fn with_clients() {
const TOML: &'static str = "[package.metadata.cargonauts.clients.foo]\nbar = 0";
let cfg = CargonautsConfig::from_toml(TOML).unwrap();
assert!(cfg... | 23.533333 | 84 | 0.68272 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn toml_ctor() {\n assert!(CargonautsConfig::from_toml(\"[package.metadata.cargonauts]\").is_ok())\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn with_clients() {\n const TOML: &'static str = \"[package.metadata.carg... |
f71214967a3bff2bec002031c4f35f974105e0a2 | 19,564 | rs | Rust | src/graphics/lib/compute/spinel-rs/src/spinel_sys.rs | zhangpf/fuchsia-rs | 903568f28ddf45f09157ead36d61b50322c9cf49 | [
"BSD-3-Clause"
] | 3 | 2020-08-02T04:46:18.000Z | 2020-08-07T10:10:53.000Z | src/graphics/lib/compute/spinel-rs/src/spinel_sys.rs | zhangpf/fuchsia-rs | 903568f28ddf45f09157ead36d61b50322c9cf49 | [
"BSD-3-Clause"
] | 16 | 2020-09-04T19:01:11.000Z | 2021-05-28T03:23:09.000Z | src/graphics/lib/compute/spinel-rs/src/spinel_sys.rs | ZVNexus/fuchsia | c5610ad15208208c98693618a79c705af935270c | [
"BSD-3-Clause"
] | 1 | 2020-08-07T10:11:49.000Z | 2020-08-07T10:11:49.000Z | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![allow(dead_code)]
use std::fmt;
use failure::Fail;
macro_rules! spinel_errors {
( @Error, $success:ident, $( $errors:ident ),* ) => {
#[d... | 28.983704 | 99 | 0.611122 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn spinel_null() {\n let context: SpnContext = SpnContext::default();\n\n unsafe {\n spn_context_release(context).res().unwrap();\n }\n }\n}"
] |
f712dc99a19568f5b69bf165911653d4f3b6d92c | 2,230 | rs | Rust | src/mime.rs | sassman/rustypaste | dbda1bb94ae37827ac495a796cb9b819a1dfc48b | [
"MIT"
] | 86 | 2021-07-27T11:56:57.000Z | 2022-03-31T09:51:06.000Z | src/mime.rs | sassman/rustypaste | dbda1bb94ae37827ac495a796cb9b819a1dfc48b | [
"MIT"
] | 20 | 2021-07-27T17:16:45.000Z | 2022-03-25T22:13:04.000Z | src/mime.rs | sassman/rustypaste | dbda1bb94ae37827ac495a796cb9b819a1dfc48b | [
"MIT"
] | 10 | 2021-07-28T03:16:44.000Z | 2022-03-25T00:01:28.000Z | use actix_files::file_extension_to_mime;
use mime::{FromStrError, Mime};
use regex::Regex;
use std::path::PathBuf;
use std::str::FromStr;
/// Matcher for MIME types.
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
pub struct MimeMatcher {
/// MIME type to set for the matched file name.
p... | 26.547619 | 70 | 0.507623 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_match_mime_type() {\n assert_eq!(\n mime::TEXT_PLAIN,\n get_mime_type(\n &[MimeMatcher {\n mime: String::from(\"text/plain\"),\n regex: Regex::new(\"^.*\\\\.test$... |
f713567653955827d666da4c41558fb74563dda5 | 1,111 | rs | Rust | exercises/error_handling/errors1.rs | jewlexx/rustlings | 7f1d8d2710b72a1a3661b6a65afe1304c348831b | [
"MIT"
] | null | null | null | exercises/error_handling/errors1.rs | jewlexx/rustlings | 7f1d8d2710b72a1a3661b6a65afe1304c348831b | [
"MIT"
] | null | null | null | exercises/error_handling/errors1.rs | jewlexx/rustlings | 7f1d8d2710b72a1a3661b6a65afe1304c348831b | [
"MIT"
] | null | null | null | // errors1.rs
// This function refuses to generate text to be printed on a nametag if
// you pass it an empty string. It'd be nicer if it explained what the problem
// was, instead of just sometimes returning `None`. Thankfully, Rust has a similar
// construct to `Option` that can be used to express error conditions. L... | 30.027027 | 84 | 0.613861 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn generates_nametag_text_for_a_nonempty_name() {\n assert_eq!(\n generate_nametag_text(\"Beyoncé\".into()),\n Ok(\"Hi! My name is Beyoncé\".into())\n );\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n ... |
f713843ef457f2da0af3afee9e4ca671748eaa62 | 7,069 | rs | Rust | air/src/air/boundary/tests.rs | Shibaura4/winterfell | 2d6ad828e466f9dd1faa053e8759ade6bab75a4f | [
"MIT"
] | 2 | 2021-11-17T22:51:13.000Z | 2021-11-17T22:53:02.000Z | air/src/air/boundary/tests.rs | Shibaura4/winterfell | 2d6ad828e466f9dd1faa053e8759ade6bab75a4f | [
"MIT"
] | null | null | null | air/src/air/boundary/tests.rs | Shibaura4/winterfell | 2d6ad828e466f9dd1faa053e8759ade6bab75a4f | [
"MIT"
] | null | null | null | // Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
use super::{
super::tests::{build_prng, build_sequence_poly},
Assertion, BoundaryConstraint,
};
use crypto::{hashers::Blake3_256, ... | 37.205263 | 99 | 0.654689 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn boundary_constraint_from_single_assertion() {\n let mut test_prng = build_prng();\n let (inv_g, mut twiddle_map, mut prng) = build_constraint_params(16);\n\n // constraint should be built correctly for register 0, step 0\n let value = Ba... |
f7138769a8a537765a4d063213d6786cec3535f8 | 2,477 | rs | Rust | backend/db/tests/calls/auth.rs | hgzimmerman/FullstackRustDemo | b925cf8a157dc3ef22d85324332a814dcfbc634b | [
"MIT"
] | 31 | 2019-03-10T09:04:45.000Z | 2022-01-24T03:02:03.000Z | backend/db/tests/calls/auth.rs | hgzimmerman/WeekendAtJoes4 | b925cf8a157dc3ef22d85324332a814dcfbc634b | [
"MIT"
] | 82 | 2017-12-31T20:46:39.000Z | 2018-11-05T14:31:20.000Z | backend/db/tests/calls/auth.rs | hgzimmerman/FullstackRustDemo | b925cf8a157dc3ef22d85324332a814dcfbc634b | [
"MIT"
] | 4 | 2019-12-04T10:17:11.000Z | 2021-01-24T04:26:46.000Z | //use calls::user::{UserFixture};
use testing_fixtures::fixtures::user::UserFixture;
use testing_fixtures::fixtures::user::PASSWORD;
use common::setup::*;
use diesel::PgConnection;
//use db::user::{User, NewUser};
use db::auth;
use wire::login::LoginRequest;
use auth_lib::ServerJwt;
#[test]
fn fail_login_invalid_pass... | 34.887324 | 119 | 0.641098 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fail_login_invalid_password() {\n setup(|fixture: &UserFixture, conn: &PgConnection| {\n let bad_login = LoginRequest {\n user_name: fixture.admin_user.user_name.clone(),\n password: \"Invalid Password\".to_string(),\... |
f7138c9e227b0e1d6663ad1b96d13eae935f396d | 6,132 | rs | Rust | http-client/src/lib.rs | ChrisRx/capability-providers | de839ddfc624729fc5dca828417aaff4c8cb15be | [
"Apache-2.0"
] | null | null | null | http-client/src/lib.rs | ChrisRx/capability-providers | de839ddfc624729fc5dca828417aaff4c8cb15be | [
"Apache-2.0"
] | null | null | null | http-client/src/lib.rs | ChrisRx/capability-providers | de839ddfc624729fc5dca828417aaff4c8cb15be | [
"Apache-2.0"
] | null | null | null | ///!
///! # http-client-provider
///! This library exposes the HTTP client capability to waSCC-compliant actors
mod http_client;
#[macro_use]
extern crate wascc_codec as codec;
#[macro_use]
extern crate log;
use codec::capabilities::{
CapabilityDescriptor, CapabilityProvider, Dispatcher, NullDispatcher, Operatio... | 31.772021 | 97 | 0.579419 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_request() {\n let _ = env_logger::try_init();\n let request = Request {\n method: \"GET\".to_string(),\n path: mockito::server_url(),\n header: HashMap::new(),\n body: vec![],\n ... |
f713c13d94595aafc5eddc0b874006c0d86a6822 | 4,519 | rs | Rust | src/libsync/comm.rs | ehsanul/rust | 7156ded5bcf6831a6da22688d08f71985fdc81df | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libsync/comm.rs | ehsanul/rust | 7156ded5bcf6831a6da22688d08f71985fdc81df | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libsync/comm.rs | ehsanul/rust | 7156ded5bcf6831a6da22688d08f71985fdc81df | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 27.05988 | 88 | 0.583315 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n pub fn DuplexStream1() {\n let (left, right) = duplex();\n\n left.send(~\"abc\");\n right.send(123);\n\n assert!(left.recv() == 123);\n assert!(right.recv() == ~\"abc\");\n }\n\n #[test]\n pub fn basic_rendez... |
f713f39d872d57ac31007cb7201b002a495053a5 | 178,909 | rs | Rust | src/blockdata/transaction.rs | cloudhead/rust-bitcoin | 926cff0741dd0dc177ecf92b289020a593406f6f | [
"CC0-1.0"
] | null | null | null | src/blockdata/transaction.rs | cloudhead/rust-bitcoin | 926cff0741dd0dc177ecf92b289020a593406f6f | [
"CC0-1.0"
] | null | null | null | src/blockdata/transaction.rs | cloudhead/rust-bitcoin | 926cff0741dd0dc177ecf92b289020a593406f6f | [
"CC0-1.0"
] | null | null | null | // Rust Bitcoin Library
// Written in 2014 by
// Andrew Poelstra <apoelstra@wpsoftware.net>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warrant... | 134.720633 | 1,659 | 0.868006 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_outpoint() {\n assert_eq!(OutPoint::from_str(\"i don't care\"),\n Err(ParseOutPointError::Format));\n assert_eq!(OutPoint::from_str(\"5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456:1:1\"),\n ... |
f7143a4f981555a4ee1383983e6408b9b7d5abd1 | 20,972 | rs | Rust | src/libarena/lib.rs | mksully22/rust | 1962a70e71e82516a4436e00933654a990203c9e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libarena/lib.rs | mksully22/rust | 1962a70e71e82516a4436e00933654a990203c9e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libarena/lib.rs | mksully22/rust | 1962a70e71e82516a4436e00933654a990203c9e | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 30.394203 | 100 | 0.51502 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n pub fn test_unused() {\n let arena: TypedArena<Point> = TypedArena::new();\n assert!(arena.chunks.borrow().is_empty());\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_arena_alloc_nested() {\n ... |
f71446758a26e56e1ce22f991323e2936d824678 | 1,553 | rs | Rust | exercises/enums/enums3.rs | JBlackCat/rustlings | 604665003aaa4710d1d3c6abf8fae398f69842fe | [
"MIT"
] | null | null | null | exercises/enums/enums3.rs | JBlackCat/rustlings | 604665003aaa4710d1d3c6abf8fae398f69842fe | [
"MIT"
] | null | null | null | exercises/enums/enums3.rs | JBlackCat/rustlings | 604665003aaa4710d1d3c6abf8fae398f69842fe | [
"MIT"
] | null | null | null | // enums3.rs
// Address all the TODOs to make the tests pass!
enum Message {
ChangeColor((u8, u8, u8)),
Echo(String),
Move(Point),
Quit
}
struct Point {
x: u8,
y: u8,
}
struct State {
color: (u8, u8, u8),
position: Point,
quit: bool,
}
impl State {
fn change_color(&mut self, ... | 21.873239 | 76 | 0.518995 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_match_message_call() {\n let mut state = State {\n quit: false,\n position: Point { x: 0, y: 0 },\n color: (0, 0, 0),\n };\n state.process(Message::ChangeColor((255, 0, 255)));\n stat... |
f71448a81f6e86757c21a6d3de4ba6dbd54120d5 | 2,274 | rs | Rust | rust/pig-latin/tests/pig-latin.rs | TheTonttu/exercism-solutions | 25420fc86d4b4a12e45f14f7472546f10f8864ea | [
"MIT"
] | null | null | null | rust/pig-latin/tests/pig-latin.rs | TheTonttu/exercism-solutions | 25420fc86d4b4a12e45f14f7472546f10f8864ea | [
"MIT"
] | null | null | null | rust/pig-latin/tests/pig-latin.rs | TheTonttu/exercism-solutions | 25420fc86d4b4a12e45f14f7472546f10f8864ea | [
"MIT"
] | null | null | null | use pig_latin as pl;
#[test]
fn test_word_beginning_with_a() {
assert_eq!(pl::translate("apple"), "appleay");
}
#[test]
fn test_word_beginning_with_e() {
assert_eq!(pl::translate("ear"), "earay");
}
#[test]
fn test_word_beginning_with_i() {
assert_eq!(pl::translate("igloo"), "iglooay");
}
#[test]
fn tes... | 20.123894 | 72 | 0.683817 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_word_beginning_with_a() {\n assert_eq!(pl::translate(\"apple\"), \"appleay\");\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_word_beginning_with_e() {\n assert_eq!(pl::translate(\"ear\"), \"earay\");\n}... |
f7145805d9ba76e82d46dfe0d6103006b2912298 | 8,871 | rs | Rust | rust/crd/src/lib.rs | stackabletech/operator-skeleton | bf12dc77c98f19ae8c4fc49b25f42126a87c4874 | [
"Apache-2.0"
] | null | null | null | rust/crd/src/lib.rs | stackabletech/operator-skeleton | bf12dc77c98f19ae8c4fc49b25f42126a87c4874 | [
"Apache-2.0"
] | 4 | 2021-10-18T01:14:39.000Z | 2022-03-24T11:48:21.000Z | rust/crd/src/lib.rs | stackabletech/operator-skeleton | bf12dc77c98f19ae8c4fc49b25f42126a87c4874 | [
"Apache-2.0"
] | null | null | null | pub mod commands;
pub mod error;
use crate::commands::{Restart, Start, Stop};
use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
use k8s_openapi::schemars::_serde_json::Value;
use kube::api::ApiResource;
use kube::CustomResource;
use kube::CustomResourceExt;
use schemars::JsonSchema;
use semver::Version;
... | 29.471761 | 143 | 0.645361 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_productname_version_versioning() {\n assert_eq!(\n ProductnameVersion::v1_0_0.versioning_state(&ProductnameVersion::v2_0_0),\n VersioningState::ValidUpgrade\n );\n assert_eq!(\n ProductnameV... |
f71467c7352e861a29ec0f1f583126eda7b90e69 | 42,187 | rs | Rust | ecmascript/transforms/optimization/src/simplify/branch/tests.rs | dispalt/swc | 840305726875f250babe254d16e9f01e36305477 | [
"Apache-2.0",
"MIT"
] | null | null | null | ecmascript/transforms/optimization/src/simplify/branch/tests.rs | dispalt/swc | 840305726875f250babe254d16e9f01e36305477 | [
"Apache-2.0",
"MIT"
] | null | null | null | ecmascript/transforms/optimization/src/simplify/branch/tests.rs | dispalt/swc | 840305726875f250babe254d16e9f01e36305477 | [
"Apache-2.0",
"MIT"
] | null | null | null | use super::{super::expr_simplifier, dead_branch_remover};
use swc_common::chain;
macro_rules! test_stmt {
($l:expr, $r:expr) => {
swc_ecma_transforms_testing::test_transform(
::swc_ecma_parser::Syntax::default(),
|_| chain!(expr_simplifier(Default::default()), dead_branch_remover())... | 23.502507 | 100 | 0.432384 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn usage() {\n test_stmt!(\"use(8+8);\", \"use(16);\");\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn compiled_out_simple() {\n compiled_out!(\";\");\n compiled_out!(\"8;\");\n compiled_out!(\"8+8;\");\n}\n}",... |
f71483380d0a95de945daaf532984069d9276dad | 33,117 | rs | Rust | components/merkledb/src/indexes/proof_list/tests.rs | SergeiMal/exonum | 520324a321462bceb8acda9a92b9ed63fcdc3eaf | [
"Apache-2.0"
] | null | null | null | components/merkledb/src/indexes/proof_list/tests.rs | SergeiMal/exonum | 520324a321462bceb8acda9a92b9ed63fcdc3eaf | [
"Apache-2.0"
] | null | null | null | components/merkledb/src/indexes/proof_list/tests.rs | SergeiMal/exonum | 520324a321462bceb8acda9a92b9ed63fcdc3eaf | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 The Exonum Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... | 30.692308 | 98 | 0.552707 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn list_methods() {\n let db = TemporaryDB::new();\n let fork = db.fork();\n let mut index = fork.get_proof_list(IDX_NAME);\n\n assert!(index.is_empty());\n assert_eq!(index.len(), 0);\n index.push(vec![1]);\n assert!(!index.is_emp... |
f71493d96c9c33c1227f34207ca8efea2b2b47dd | 1,773 | rs | Rust | src/days/day5.rs | PedroDiogo/AdventOfCode2020 | 0a61f3fb755a3f21cea81f6b07423dba7a610cee | [
"MIT"
] | null | null | null | src/days/day5.rs | PedroDiogo/AdventOfCode2020 | 0a61f3fb755a3f21cea81f6b07423dba7a610cee | [
"MIT"
] | null | null | null | src/days/day5.rs | PedroDiogo/AdventOfCode2020 | 0a61f3fb755a3f21cea81f6b07423dba7a610cee | [
"MIT"
] | null | null | null | use super::lib::*;
pub fn run() -> (Option<String>, Option<String>) {
let filename = "inputs/day5.txt";
let inputs = read_inputs(&filename);
let seat_ids = inputs
.lines()
.map(|line| convert_boarding_pass_to_binary(line))
.filter_map(|line| convert_from_binary(&line).ok());
l... | 26.462687 | 78 | 0.58432 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_convert_boarding_pass_to_binary() {\n assert_eq!(\"0101100\", convert_boarding_pass_to_binary(\"FBFBBFF\"));\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_convert_from_binary() -> Result<(), std::n... |
f714a599bf18636369a38e885a96d943136342cd | 3,441 | rs | Rust | src/observable/trivial.rs | Fice/rxRust | 2a988165bdef86f4dbea9e115359e0a82bbafd6b | [
"MIT"
] | null | null | null | src/observable/trivial.rs | Fice/rxRust | 2a988165bdef86f4dbea9e115359e0a82bbafd6b | [
"MIT"
] | null | null | null | src/observable/trivial.rs | Fice/rxRust | 2a988165bdef86f4dbea9e115359e0a82bbafd6b | [
"MIT"
] | null | null | null | use crate::prelude::*;
use std::marker::PhantomData;
/// Creates an observable that emits no items, just terminates with an error.
///
/// # Arguments
///
/// * `e` - An error to emit and terminate with
pub fn throw<Err>(e: Err) -> ObservableBase<ThrowEmitter<Err>> {
ObservableBase::new(ThrowEmitter(e))
}
#[derive(... | 23.408163 | 80 | 0.650392 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn throw() {\n let mut value_emitted = false;\n let mut completed = false;\n let mut error_emitted = String::new();\n observable::throw(String::from(\"error\")).subscribe_all(\n // helping with type inference\n |_| value_emitted =... |
f714d63565c9f10a156de31b70d03968b3dfd4ee | 593 | rs | Rust | exercises/collections/vec1.rs | kshitijk20/rustlings | 4c9baa7c709989f64295d4d8c3826a3ed2f25c58 | [
"MIT"
] | null | null | null | exercises/collections/vec1.rs | kshitijk20/rustlings | 4c9baa7c709989f64295d4d8c3826a3ed2f25c58 | [
"MIT"
] | null | null | null | exercises/collections/vec1.rs | kshitijk20/rustlings | 4c9baa7c709989f64295d4d8c3826a3ed2f25c58 | [
"MIT"
] | null | null | null | // vec1.rs
// Your task is to create a `Vec` which holds the exact same elements
// as in the array `a`.
// Make me compile and pass the test!
// Execute the command `rustlings hint vec1` if you need hints.
fn array_and_vec() -> ([i32; 4], Vec<i32>) {
let a = [10, 20, 30, 40]; // a plain array
let v = vec![1... | 21.962963 | 69 | 0.591906 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_array_and_vec_similarity() {\n let (a, v) = array_and_vec();\n assert_eq!(a, v[..]);\n }\n}"
] |
f714f646143e554a5b47c23e14feb08de41cb6db | 2,412 | rs | Rust | beacon_node/src/fake_time.rs | simonasstipinas/framework | e69798385fe8a8e4200fd5146a4d5ae8633d3409 | [
"Apache-2.0"
] | null | null | null | beacon_node/src/fake_time.rs | simonasstipinas/framework | e69798385fe8a8e4200fd5146a4d5ae8633d3409 | [
"Apache-2.0"
] | null | null | null | beacon_node/src/fake_time.rs | simonasstipinas/framework | e69798385fe8a8e4200fd5146a4d5ae8633d3409 | [
"Apache-2.0"
] | null | null | null | //! Traits for testing code that uses [`Instant`] and [`SystemTime`].
//!
//! [`Instant`]: std::time::Instant
//! [`SystemTime`]: std::time::SystemTime
use core::{ops::Add, time::Duration};
use std::{
error::Error,
time::{Instant, SystemTime, SystemTimeError},
};
use thiserror::Error;
pub trait InstantLik... | 26.505495 | 99 | 0.670813 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn has_excellent_test_coverage() {\n let duration = Duration::from_secs(10000);\n let earlier = <SystemTime as SystemTimeLike>::UNIX_EPOCH;\n let later = <SystemTime as SystemTimeLike>::UNIX_EPOCH + duration;\n let differenc... |
f71529b926b7e1dba2a0bb419f9f9eb4e8107812 | 204 | rs | Rust | tests/exit_success.rs | foresterre/exit-with-code | 39038ac947b735db6d0a46ba80dcbfc3f1fe54a7 | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/exit_success.rs | foresterre/exit-with-code | 39038ac947b735db6d0a46ba80dcbfc3f1fe54a7 | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/exit_success.rs | foresterre/exit-with-code | 39038ac947b735db6d0a46ba80dcbfc3f1fe54a7 | [
"Apache-2.0",
"MIT"
] | null | null | null | #[test]
fn exit_success() {
let mut child = std::process::Command::new(env!("CARGO_BIN_EXE_ewc"))
.arg("0")
.spawn()
.unwrap();
assert!(child.wait().unwrap().success())
}
| 20.4 | 73 | 0.54902 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn exit_success() {\n let mut child = std::process::Command::new(env!(\"CARGO_BIN_EXE_ewc\"))\n .arg(\"0\")\n .spawn()\n .unwrap();\n\n assert!(child.wait().unwrap().success())\n}\n}"
] |
f715300d1f35f7914046598f60aa4ff33d4596f9 | 2,157 | rs | Rust | src/tests/integration/toggle_fullscreen.rs | 5c077m4n/mosaic | 63a2dc33995fad81c7eec02b23e38afdc3f426e8 | [
"MIT"
] | null | null | null | src/tests/integration/toggle_fullscreen.rs | 5c077m4n/mosaic | 63a2dc33995fad81c7eec02b23e38afdc3f426e8 | [
"MIT"
] | null | null | null | src/tests/integration/toggle_fullscreen.rs | 5c077m4n/mosaic | 63a2dc33995fad81c7eec02b23e38afdc3f426e8 | [
"MIT"
] | null | null | null | use insta::assert_snapshot;
use crate::panes::PositionAndSize;
use crate::tests::fakes::FakeInputOutput;
use crate::tests::utils::get_output_frame_snapshots;
use crate::{start, CliArgs};
use crate::tests::utils::commands::{
CLOSE_FOCUSED_PANE, COMMAND_TOGGLE, MOVE_FOCUS, QUIT, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY... | 27.653846 | 95 | 0.665739 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n pub fn adding_new_terminal_in_fullscreen() {\n let fake_win_size = PositionAndSize {\n columns: 121,\n rows: 20,\n x: 0,\n y: 0,\n };\n let mut fake_input_output = get_fake_os_input(&fake_win_size);\n fake_input_... |
f7154781b357215cd33a7c4d14115d5d3e473aef | 2,425 | rs | Rust | src/test/instruction_tests/instr_andnps.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | src/test/instruction_tests/instr_andnps.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | src/test/instruction_tests/instr_andnps.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | use instruction_def::*;
use test::run_test;
use Operand::*;
use Reg::*;
use RegScale::*;
use RegType::*;
use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
#[test]
fn andnps_1() {
run_test(
&Instruction {
mnemonic: Mnemonic::ANDNPS,
opera... | 23.543689 | 95 | 0.458969 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn andnps_1() {\n run_test(\n &Instruction {\n mnemonic: Mnemonic::ANDNPS,\n operand1: Some(Direct(XMM2)),\n operand2: Some(Direct(XMM0)),\n operand3: None,\n operand4: None,\n ... |
f71575df29ddf8f00b9b883d94509d92029143db | 4,817 | rs | Rust | libtransact/src/collections/ref_map.rs | peterschwarz/transact | a356d456aee65b1aa73a5cf397a72b504b27093e | [
"Apache-2.0"
] | 58 | 2019-06-27T16:28:13.000Z | 2022-03-22T15:40:46.000Z | libtransact/src/collections/ref_map.rs | peterschwarz/transact | a356d456aee65b1aa73a5cf397a72b504b27093e | [
"Apache-2.0"
] | 20 | 2019-07-01T21:11:32.000Z | 2022-03-01T17:04:46.000Z | libtransact/src/collections/ref_map.rs | peterschwarz/transact | a356d456aee65b1aa73a5cf397a72b504b27093e | [
"Apache-2.0"
] | 41 | 2019-05-21T22:07:59.000Z | 2022-03-25T13:07:42.000Z | // Copyright 2018-2021 Cargill Incorporated
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... | 33.685315 | 99 | 0.617812 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_add_ref() {\n let mut ref_map = RefMap::new();\n let ref_count = ref_map.add_ref(\"test_id\".to_string());\n assert_eq!(ref_count, 1);\n\n let ref_count = ref_map.add_ref(\"test_id\".to_string());\n assert_eq!... |
f715768606134ea62a547513e6e4384d56c35d3a | 9,065 | rs | Rust | rust/arrow/src/compute/kernels/substring.rs | sutoiku/arrow | 97b06d99aa1af46f92e83f9c8ca669f54802b257 | [
"Apache-2.0"
] | 1 | 2020-09-07T15:12:11.000Z | 2020-09-07T15:12:11.000Z | rust/arrow/src/compute/kernels/substring.rs | sutoiku/arrow | 97b06d99aa1af46f92e83f9c8ca669f54802b257 | [
"Apache-2.0"
] | 3 | 2020-09-07T09:53:32.000Z | 2020-09-07T15:12:18.000Z | rust/arrow/src/compute/kernels/substring.rs | sutoiku/arrow | 97b06d99aa1af46f92e83f9c8ca669f54802b257 | [
"Apache-2.0"
] | 1 | 2021-02-15T05:29:37.000Z | 2021-02-15T05:29:37.000Z | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | 33.574074 | 132 | 0.479868 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn with_nulls_string() -> Result<()> {\n with_nulls::<StringArray>()\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn with_nulls_large_string() -> Result<()> {\n with_nulls::<LargeStringArray>()\n }\n}",... |
f715834e6f364297c794898de7ceff4a7b4cccb6 | 1,831 | rs | Rust | language/compiler/src/unit_tests/import_tests.rs | BlockSuite/libra | 27c125594ee82c8edb361f0c4cf79c9fa101dd68 | [
"Apache-2.0"
] | 206 | 2021-03-04T07:17:49.000Z | 2022-03-26T12:19:52.000Z | language/compiler/src/unit_tests/import_tests.rs | BlockSuite/libra | 27c125594ee82c8edb361f0c4cf79c9fa101dd68 | [
"Apache-2.0"
] | 663 | 2020-09-02T03:23:32.000Z | 2022-03-31T18:05:38.000Z | language/compiler/src/unit_tests/import_tests.rs | BlockSuite/libra | 27c125594ee82c8edb361f0c4cf79c9fa101dd68 | [
"Apache-2.0"
] | 90 | 2021-03-16T12:43:47.000Z | 2022-03-30T21:08:36.000Z | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::unit_tests::testutils::{
compile_module_string_with_stdlib, compile_script_string_with_stdlib,
};
#[test]
fn compile_script_with_imports() {
let code = String::from(
"
import 0x1.DiemCoin;
ma... | 28.609375 | 74 | 0.527034 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn compile_script_with_imports() {\n let code = String::from(\n \"\n import 0x1.DiemCoin;\n\n main() {\n let x: u64;\n let y: u64;\n x = 2;\n y = copy(x) + copy(x);\n return... |
f715970afe64338cc85cbb2028dd5377265b4c11 | 11,505 | rs | Rust | timer/src/lib.rs | mmmorris/pi_lib | 4d3223fff84f7a5339a2a5039481f7f0994c0c92 | [
"Apache-2.0",
"MIT"
] | null | null | null | timer/src/lib.rs | mmmorris/pi_lib | 4d3223fff84f7a5339a2a5039481f7f0994c0c92 | [
"Apache-2.0",
"MIT"
] | null | null | null | timer/src/lib.rs | mmmorris/pi_lib | 4d3223fff84f7a5339a2a5039481f7f0994c0c92 | [
"Apache-2.0",
"MIT"
] | null | null | null | #![feature(integer_atomics)]
extern crate atom;
extern crate apm;
extern crate wheel;
extern crate time;
#[macro_use]
extern crate lazy_static;
use std::sync::Arc;
use std::sync::Mutex;
use std::thread;
use std::time::{Duration};
use std::sync::atomic::{AtomicUsize, Ordering, AtomicU64};
use std::mem:... | 28.337438 | 139 | 0.548196 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test(){\r\n TIMER.run();\r\n //thread::sleep(Duration::from_millis(8));\r\n //let now = now_millis();\r\n TIMER.set_timeout(FuncRuner::new(Box::new(move||{\r\n println!(\"test timer Success\");\r\n\t})), 10);\r\n\t//let index = TI... |
f715da005050e32460dd9fb6ecc4ea219aaddcff | 843 | rs | Rust | day3-2/tests/samples.rs | zayenz/advent-of-code-2019 | 0c90194dfe6c544ad3c0dc27980e034e97c372e8 | [
"MIT"
] | null | null | null | day3-2/tests/samples.rs | zayenz/advent-of-code-2019 | 0c90194dfe6c544ad3c0dc27980e034e97c372e8 | [
"MIT"
] | null | null | null | day3-2/tests/samples.rs | zayenz/advent-of-code-2019 | 0c90194dfe6c544ad3c0dc27980e034e97c372e8 | [
"MIT"
] | null | null | null | use assert_cli;
#[test]
fn sample0() {
assert_cli::Assert::main_binary()
.stdin(
"R8,U5,L5,D3
U7,R6,D4,L4",
)
.stdout()
.is("30")
.unwrap();
}
#[test]
fn sample1() {
assert_cli::Assert::main_binary()
.stdin(
"R75,D30,R83,U83,L12,D49,R71,U... | 17.93617 | 56 | 0.488731 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn sample0() {\n assert_cli::Assert::main_binary()\n .stdin(\n \"R8,U5,L5,D3\nU7,R6,D4,L4\",\n )\n .stdout()\n .is(\"30\")\n .unwrap();\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test... |
f715f9d028ac7c7417226286c606eaaa866c7fbe | 682 | rs | Rust | src/book/ch3/mytest_struct/src/lib.rs | banbiossa/book-rust | 209965a90767927bd2d909e4de18fe6f1e6ea729 | [
"MIT"
] | 24 | 2021-09-26T13:27:51.000Z | 2022-03-24T00:38:40.000Z | src/book/ch3/mytest_struct/src/lib.rs | banbiossa/book-rust | 209965a90767927bd2d909e4de18fe6f1e6ea729 | [
"MIT"
] | null | null | null | src/book/ch3/mytest_struct/src/lib.rs | banbiossa/book-rust | 209965a90767927bd2d909e4de18fe6f1e6ea729 | [
"MIT"
] | 4 | 2022-01-24T02:30:41.000Z | 2022-03-12T08:01:13.000Z | // 商品を表す構造体を定義 --- (*1)
#[derive(Debug,PartialEq)]
struct GItem {
name: String,
price: i64,
}
#[cfg(test)]
mod tests {
use super::*; // 外側の要素を利用 --- (*2)
#[test]
fn item_test() {
// 構造体を初期化 --- (*3)
let apple1 = GItem{
name: String::from("リンゴ"),
price: 2400,
... | 21.3125 | 47 | 0.461877 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn item_test() {\n // 構造体を初期化 --- (*3)\n let apple1 = GItem{\n name: String::from(\"リンゴ\"),\n price: 2400,\n };\n let mut apple2 = GItem{\n name: \"リンゴ\".to_string(),\n price: 0,\n... |
f715fd7bedd5ad50f2079ee167c9dbf8042a6b9c | 1,244 | rs | Rust | asyncgit/src/sync/branch/rename.rs | Curiosidad-Racional/gitui | 11d1f43830ff60ff5d9e9d056d024cd29f4118dc | [
"MIT"
] | null | null | null | asyncgit/src/sync/branch/rename.rs | Curiosidad-Racional/gitui | 11d1f43830ff60ff5d9e9d056d024cd29f4118dc | [
"MIT"
] | 47 | 2021-09-28T09:21:07.000Z | 2022-03-11T09:20:29.000Z | asyncgit/src/sync/branch/rename.rs | Elbandi/gitui | eeefa5886d1a16c9fec36bcf4cf0a17cef566931 | [
"MIT"
] | 1 | 2022-03-15T20:51:56.000Z | 2022-03-15T20:51:56.000Z | //! renaming of branches
use crate::{error::Result, sync::utils};
use scopetime::scope_time;
/// Rename the branch reference
pub fn rename_branch(
repo_path: &str,
branch_ref: &str,
new_name: &str,
) -> Result<()> {
scope_time!("delete_branch");
let repo = utils::repo(repo_path)?;
let branch_as_ref = repo.find... | 18.294118 | 63 | 0.625402 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_rename_branch() {\n\t\tlet (_td, repo) = repo_init().unwrap();\n\t\tlet root = repo.path().parent().unwrap();\n\t\tlet repo_path = root.as_os_str().to_str().unwrap();\n\n\t\tcreate_branch(repo_path, \"branch1\").unwrap();\n\n\t\tcheckout_branch... |
f7160363aa6623c9a08497c17c3c604819e0d8e6 | 719 | rs | Rust | src/tests/expression_test.rs | aschaeffer/inexor-rgf-core-reactive | 7e83cc0391c6e5ced1eb33f878ba9e8efdfa2f10 | [
"MIT"
] | null | null | null | src/tests/expression_test.rs | aschaeffer/inexor-rgf-core-reactive | 7e83cc0391c6e5ced1eb33f878ba9e8efdfa2f10 | [
"MIT"
] | null | null | null | src/tests/expression_test.rs | aschaeffer/inexor-rgf-core-reactive | 7e83cc0391c6e5ced1eb33f878ba9e8efdfa2f10 | [
"MIT"
] | null | null | null | use crate::entity::Expression;
#[test]
fn expression_test() {
let expression = Expression {
lhs: false,
rhs: false,
};
assert_eq!(expression.lhs, false);
assert_eq!(expression.rhs, false);
let expression = expression.lhs(true);
assert_eq!(expression.lhs, true);
let expressio... | 26.62963 | 51 | 0.667594 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn expression_test() {\n let expression = Expression {\n lhs: false,\n rhs: false,\n };\n assert_eq!(expression.lhs, false);\n assert_eq!(expression.rhs, false);\n let expression = expression.lhs(true);\n assert_eq!(expr... |
f71614799f532f91aa281024e7b25881bb784291 | 387 | rs | Rust | src/lib.rs | GiGurra/rust-util | a241640ed0c49846e3a8fed10465e5e294de8941 | [
"MIT"
] | null | null | null | src/lib.rs | GiGurra/rust-util | a241640ed0c49846e3a8fed10465e5e294de8941 | [
"MIT"
] | null | null | null | src/lib.rs | GiGurra/rust-util | a241640ed0c49846e3a8fed10465e5e294de8941 | [
"MIT"
] | null | null | null | pub mod file;
pub mod shell;
pub mod string;
pub mod logging;
pub mod crypt;
pub use serde_yaml;
pub use serde;
pub use regex;
pub use log;
pub use simple_logger;
pub use itertools;
pub use clap;
pub use aes_gcm;
pub use rand;
pub use rand_chacha;
pub use hex;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
... | 14.333333 | 30 | 0.653747 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn it_works() {\n let result = 2 + 2;\n assert_eq!(result, 4);\n }\n}"
] |
f7161fc0d88fcae136800fceb7274038432af02e | 24,331 | rs | Rust | crates/ide/src/lib.rs | xiyuzhai/rust-analyzer-cleaned | b761ab2b23cf4805b278416f3a518fb5d58d8b96 | [
"Apache-2.0",
"MIT"
] | null | null | null | crates/ide/src/lib.rs | xiyuzhai/rust-analyzer-cleaned | b761ab2b23cf4805b278416f3a518fb5d58d8b96 | [
"Apache-2.0",
"MIT"
] | null | null | null | crates/ide/src/lib.rs | xiyuzhai/rust-analyzer-cleaned | b761ab2b23cf4805b278416f3a518fb5d58d8b96 | [
"Apache-2.0",
"MIT"
] | null | null | null | //! ide crate provides "ide-centric" APIs for the rust-analyzer. That is,
//! it generally operates with files and text ranges, and returns results as
//! Strings, suitable for displaying to the human.
//!
//! What powers this API are the `RootDatabase` struct, which defines a `salsa`
//! database, and the `hir` crate,... | 35.160405 | 100 | 0.651062 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn analysis_is_send() {\n fn is_send<T: Send>() {}\n is_send::<Analysis>();\n}\n}"
] |
f71622d2f86408c0178d4aef0b9953dfd19e54b6 | 7,487 | rs | Rust | networking/src/lib.rs | zshipko/tezedge | 8746d5ac51dcbf2c920447e5083436225a55cde7 | [
"MIT"
] | 1 | 2021-12-22T21:56:44.000Z | 2021-12-22T21:56:44.000Z | networking/src/lib.rs | zshipko/tezedge | 8746d5ac51dcbf2c920447e5083436225a55cde7 | [
"MIT"
] | null | null | null | networking/src/lib.rs | zshipko/tezedge | 8746d5ac51dcbf2c920447e5083436225a55cde7 | [
"MIT"
] | null | null | null | // Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
#![forbid(unsafe_code)]
//! This crate handles low level p2p communication.
use std::net::SocketAddr;
use std::sync::Arc;
use crypto::hash::CryptoboxPublicKeyHash;
use tezos_identity::Identity;
use tezos_messages::p2p::encoding::... | 39.405263 | 163 | 0.663417 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_shell_version() {\n let tested = ShellCompatibilityVersion::new(\"TEST_CHAIN\".to_string(), vec![3, 4], vec![1, 2]);\n\n assert!(matches!(tested.choose_compatible_version(&NetworkVersion::new(\"TEST_XYZ\".to_string(), 0, 0)), Err(... |
f716615c1c641116e3af65f6f203e078099221bd | 11,452 | rs | Rust | src/group.rs | Arian94/meta-functional-regex | 8a3186a8536edfbd8491f6ccfdbdc7660a78a49d | [
"MIT"
] | null | null | null | src/group.rs | Arian94/meta-functional-regex | 8a3186a8536edfbd8491f6ccfdbdc7660a78a49d | [
"MIT"
] | null | null | null | src/group.rs | Arian94/meta-functional-regex | 8a3186a8536edfbd8491f6ccfdbdc7660a78a49d | [
"MIT"
] | null | null | null | //! Creates a group pattern in many different ways as desired.
//!
//! This module consists of methods needed to create a group in many different ways, having different options/settings.
//! The main one is the [`group`](../struct.EasyRegex.html#method.group) method which takes an expression as argument
//! and a set ... | 37.671053 | 131 | 0.532745 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn group_works() {\n let initial_exp = EasyRegex::new(\"initial_\");\n let result = initial_exp.group(\"group\", &DEFAULT_GROUP);\n assert_eq!(\"initial_(group)\", result.0);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super:... |
f716670000bc8c41c09c5cff2e2f72daa4cfc8d6 | 7,889 | rs | Rust | src/sinks/util/service.rs | sciyoshi/vector | a7aa9e4cb29402942b0b97dd28fe25d4ff598aa4 | [
"Apache-2.0"
] | null | null | null | src/sinks/util/service.rs | sciyoshi/vector | a7aa9e4cb29402942b0b97dd28fe25d4ff598aa4 | [
"Apache-2.0"
] | null | null | null | src/sinks/util/service.rs | sciyoshi/vector | a7aa9e4cb29402942b0b97dd28fe25d4ff598aa4 | [
"Apache-2.0"
] | null | null | null | use super::{
retries::{FixedRetryPolicy, RetryLogic},
Batch, BatchServiceSink,
};
use crate::buffers::Acker;
use futures::Poll;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use std::time::Duration;
use tower::{
layer::{util::Stack, Layer},
limit::{concurrency::ConcurrencyLimit, rate::RateLim... | 29.657895 | 100 | 0.590062 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn map() {\n let mut task = MockTask::new();\n let (mock, mut handle) = mock::pair();\n\n let f = |r| r;\n\n let map_layer = MapLayer { f: Arc::new(f) };\n\n let mut svc = map_layer.layer(mock);\n\n task.enter(... |
f716a310701381ad1f2825edc458d6eade68e443 | 1,997 | rs | Rust | tests/curve25519.rs | ljedrz/rust-hacl-star | bb8db84e1d6b0e930de1e577276b908d0c9b3b3d | [
"MIT"
] | null | null | null | tests/curve25519.rs | ljedrz/rust-hacl-star | bb8db84e1d6b0e930de1e577276b908d0c9b3b3d | [
"MIT"
] | null | null | null | tests/curve25519.rs | ljedrz/rust-hacl-star | bb8db84e1d6b0e930de1e577276b908d0c9b3b3d | [
"MIT"
] | null | null | null | extern crate rand;
extern crate hacl_star;
use hacl_star::curve25519;
const SCALAR1: [u8; 32] = [0xa5, 0x46, 0xe3, 0x6b, 0xf0, 0x52, 0x7c, 0x9d, 0x3b, 0x16, 0x15, 0x4b, 0x82, 0x46, 0x5e, 0xdd, 0x62, 0x14, 0x4c, 0x0a, 0xc1, 0xfc, 0x5a, 0x18, 0x50, 0x6a, 0x22, 0x44, 0xba, 0x44, 0x9a, 0xc4];
const SCALAR2: [u8; 32] = [... | 49.925 | 221 | 0.643966 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_curve25519() {\n let mut output = [0; 32];\n\n curve25519::scalarmult(&mut output, &SCALAR1, &INPUT1);\n assert_eq!(output, EXPECTED1);\n\n curve25519::scalarmult(&mut output, &SCALAR2, &INPUT2);\n assert_eq!(output, EXPECTED2);\... |
f716a3861678f048c5e2fa85413f50d95ff10c74 | 8,554 | rs | Rust | crates/ra_ide/src/syntax_tree.rs | yihuang/rust-analyzer | 17ff67dd7e874ad7cff5251684fb242c4a4e3200 | [
"Apache-2.0",
"MIT"
] | null | null | null | crates/ra_ide/src/syntax_tree.rs | yihuang/rust-analyzer | 17ff67dd7e874ad7cff5251684fb242c4a4e3200 | [
"Apache-2.0",
"MIT"
] | null | null | null | crates/ra_ide/src/syntax_tree.rs | yihuang/rust-analyzer | 17ff67dd7e874ad7cff5251684fb242c4a4e3200 | [
"Apache-2.0",
"MIT"
] | null | null | null | use ra_db::{FileId, SourceDatabase};
use ra_ide_db::RootDatabase;
use ra_syntax::{
algo, AstNode, NodeOrToken, SourceFile,
SyntaxKind::{RAW_STRING, STRING},
SyntaxToken, TextRange, TextSize,
};
// Feature: Show Syntax Tree
//
// Shows the parse tree of the current file. It exists mostly for debugging
// ru... | 23.761111 | 98 | 0.513327 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_syntax_tree_without_range() {\n // Basic syntax\n let (analysis, file_id) = single_file(r#\"fn foo() {}\"#);\n let syn = analysis.syntax_tree(file_id, None).unwrap();\n\n assert_eq_text!(\n syn.trim(),\n ... |
f716a9e0f1078e7b63f65964a07fb6f31a4edfbe | 1,203 | rs | Rust | crypto-markets/tests/coinbase_pro.rs | crypto-crawler/crypto-crawler-rs | e13e5493b530a7211479987c8b9209157ebdbaa2 | [
"Apache-2.0"
] | 5 | 2022-03-23T21:39:37.000Z | 2022-03-25T22:47:25.000Z | crypto-markets/tests/coinbase_pro.rs | crypto-crawler/crypto-crawler-rs | e13e5493b530a7211479987c8b9209157ebdbaa2 | [
"Apache-2.0"
] | 2 | 2022-03-25T17:48:37.000Z | 2022-03-27T00:01:27.000Z | crypto-markets/tests/coinbase_pro.rs | crypto-crawler/crypto-crawler-rs | e13e5493b530a7211479987c8b9209157ebdbaa2 | [
"Apache-2.0"
] | 2 | 2022-03-24T09:29:24.000Z | 2022-03-26T17:36:08.000Z | use crypto_market_type::{get_market_types, MarketType};
use crypto_markets::{fetch_markets, fetch_symbols};
use crypto_pair::get_market_type;
#[macro_use]
mod utils;
const EXCHANGE_NAME: &str = "coinbase_pro";
#[test]
fn fetch_all_symbols() {
gen_all_symbols!();
}
#[test]
fn fetch_spot_symbols() {
let symbo... | 26.152174 | 74 | 0.657523 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fetch_all_symbols() {\n gen_all_symbols!();\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fetch_spot_symbols() {\n let symbols = fetch_symbols(EXCHANGE_NAME, MarketType::Spot).unwrap();\n assert!(!symbols.is_e... |
f716d1abdc9486c08fde4be2fe48dac0913768d0 | 22,488 | rs | Rust | maistra/vendor/proxy_wasm_cpp_host__bincode__1_3_1/src/config/int.rs | knm3000/proxy | f2bb57b7294aea2cb344824785be42849d7d63c9 | [
"Apache-2.0"
] | 9 | 2020-10-11T13:38:55.000Z | 2021-12-28T16:17:48.000Z | maistra/vendor/proxy_wasm_cpp_host__bincode__1_3_1/src/config/int.rs | knm3000/proxy | f2bb57b7294aea2cb344824785be42849d7d63c9 | [
"Apache-2.0"
] | 54 | 2020-06-23T17:34:04.000Z | 2022-03-31T02:04:06.000Z | maistra/vendor/proxy_wasm_cpp_host__bincode__1_3_1/src/config/int.rs | knm3000/proxy | f2bb57b7294aea2cb344824785be42849d7d63c9 | [
"Apache-2.0"
] | 12 | 2020-07-14T23:59:57.000Z | 2022-03-22T09:59:18.000Z | use std::io::Write;
use std::mem::size_of;
use super::Options;
use de::read::BincodeRead;
use error::{ErrorKind, Result};
pub trait IntEncoding {
/// Gets the size (in bytes) that a value would be serialized to.
fn u16_size(n: u16) -> u64;
/// Gets the size (in bytes) that a value would be seria... | 32.925329 | 100 | 0.517298 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_zigzag_encode() {\r\n let zigzag = VarintEncoding::zigzag_encode;\r\n\r\n assert_eq!(zigzag(0), 0);\r\n for x in 1..512 {\r\n assert_eq!(zigzag(x), (x as u64) * 2);\r\n assert_eq!(zigzag(-x), (x as u64... |
f7173e20de78d5e9c5893d122c20fa1dc362d671 | 7,455 | rs | Rust | core/src/pulse/delay.rs | Atul9/tract | e72d634892c063d0a7c588879754108df14a74de | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | core/src/pulse/delay.rs | Atul9/tract | e72d634892c063d0a7c588879754108df14a74de | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | core/src/pulse/delay.rs | Atul9/tract | e72d634892c063d0a7c588879754108df14a74de | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | use crate::internal::*;
use crate::pulse::PulsedFact;
use ndarray::*;
#[derive(Debug, new, Clone)]
struct DelayState {
buffer: Tensor,
}
impl DelayState {
pub fn eval_t<T: Datum>(&mut self, op: &Delay, input: Arc<Tensor>) -> TractResult<Arc<Tensor>> {
let axis = Axis(op.axis);
let input = inpu... | 33.133333 | 100 | 0.560027 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn sub_pulse() {\n test_pulse_delay_over(4, 1, 0);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn supra_pulse() {\n test_pulse_delay_over(4, 5, 0);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super:... |
f7174449004dc5c28780c243558ab7b94a8cf3d2 | 3,505 | rs | Rust | tests/test_buffer_protocol.rs | gi0baro/pyo3 | 49570db3fc6bd74ee3cc0405761b5b2bb24cdca3 | [
"Apache-2.0"
] | 5,774 | 2017-07-18T08:10:38.000Z | 2022-03-31T21:27:51.000Z | tests/test_buffer_protocol.rs | gi0baro/pyo3 | 49570db3fc6bd74ee3cc0405761b5b2bb24cdca3 | [
"Apache-2.0"
] | 1,729 | 2017-07-14T01:50:07.000Z | 2022-03-31T13:47:16.000Z | tests/test_buffer_protocol.rs | gi0baro/pyo3 | 49570db3fc6bd74ee3cc0405761b5b2bb24cdca3 | [
"Apache-2.0"
] | 466 | 2017-07-24T12:56:13.000Z | 2022-03-31T10:43:21.000Z | #![cfg(not(Py_LIMITED_API))]
use pyo3::buffer::PyBuffer;
use pyo3::class::PyBufferProtocol;
use pyo3::exceptions::PyBufferError;
use pyo3::ffi;
use pyo3::prelude::*;
use pyo3::types::IntoPyDict;
use pyo3::AsPyPointer;
use std::ffi::CStr;
use std::os::raw::{c_int, c_void};
use std::ptr;
use std::sync::atomic::{AtomicBo... | 26.55303 | 99 | 0.533524 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_buffer() {\n let drop_called = Arc::new(AtomicBool::new(false));\n\n {\n let gil = Python::acquire_gil();\n let py = gil.python();\n let instance = Py::new(\n py,\n TestBufferClass {\n ... |
f71793c8d0cfc91b1c779b209717bb081b01f0db | 39,307 | rs | Rust | src/exclusive_publication.rs | UnitedTraders/aeron-rs | d1f60de90ef22461404e7484219c7c2eeefa8235 | [
"Apache-2.0"
] | 63 | 2020-02-07T14:52:55.000Z | 2022-02-25T12:56:49.000Z | src/exclusive_publication.rs | UnitedTraders/aeron-rs | d1f60de90ef22461404e7484219c7c2eeefa8235 | [
"Apache-2.0"
] | 9 | 2020-04-17T07:33:49.000Z | 2021-11-11T21:14:53.000Z | src/exclusive_publication.rs | UnitedTraders/aeron-rs | d1f60de90ef22461404e7484219c7c2eeefa8235 | [
"Apache-2.0"
] | 12 | 2020-04-16T01:02:15.000Z | 2022-01-25T06:15:36.000Z | /*
* Copyright 2020 UT OVERSEAS INC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | 36.873358 | 149 | 0.633373 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn should_report_initial_position() {\n let test = ExclusivePublicationTest::new();\n let position = test.publication.position();\n assert!(position.is_ok());\n assert_eq!(position.unwrap(), 0);\n }\n}",
"#[cfg(test)]\n... |
f717da8b6247b294662449b42c4ce7dca69f058a | 3,360 | rs | Rust | src/inputfile.rs | yarrow/prettyprint | d128416c18ffc049e157173a1cc37c6a6e85eb63 | [
"Apache-2.0",
"MIT"
] | 201 | 2018-11-29T23:47:16.000Z | 2022-03-06T07:03:38.000Z | src/inputfile.rs | yarrow/prettyprint | d128416c18ffc049e157173a1cc37c6a6e85eb63 | [
"Apache-2.0",
"MIT"
] | 22 | 2018-12-01T23:16:28.000Z | 2021-09-16T13:03:06.000Z | src/inputfile.rs | yarrow/prettyprint | d128416c18ffc049e157173a1cc37c6a6e85eb63 | [
"Apache-2.0",
"MIT"
] | 15 | 2018-12-06T17:44:44.000Z | 2021-09-11T05:55:10.000Z | use std::fs::File;
use std::io::{self, BufRead, BufReader};
use content_inspector::{self, ContentType};
use crate::errors::*;
pub struct InputFileReader<'a> {
inner: Box<dyn BufRead + 'a>,
pub first_line: Vec<u8>,
pub content_type: ContentType,
}
impl<'a> InputFileReader<'a> {
fn new<R: BufRead + 'a... | 25.846154 | 81 | 0.562798 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn basic() {\n let content = b\"#!/bin/bash\\necho hello\";\n let mut reader = InputFileReader::new(&content[..]);\n\n assert_eq!(b\"#!/bin/bash\\n\", &reader.first_line[..]);\n\n let mut buffer = vec![];\n\n let res = reader.read_line(&... |
f717e3f6087071a2dec74caab1bc04cdbcfedcb0 | 10,800 | rs | Rust | src/rsdm/rsdm.rs | joshuanunn/really-simple-dispersion-wasm | 0a54b84ce84be75170818c90dfdb84c164b78c68 | [
"MIT"
] | 1 | 2021-10-03T16:27:45.000Z | 2021-10-03T16:27:45.000Z | src/rsdm/rsdm.rs | joshuanunn/really-simple-dispersion-wasm | 0a54b84ce84be75170818c90dfdb84c164b78c68 | [
"MIT"
] | 1 | 2021-01-01T14:31:23.000Z | 2021-01-03T00:31:42.000Z | src/rsdm/rsdm.rs | joshuanunn/really-simple-dispersion-wasm | 0a54b84ce84be75170818c90dfdb84c164b78c68 | [
"MIT"
] | null | null | null | use wasm_bindgen::prelude::*;
use std::f64;
use crate::rsdm::preprocess::MetHour;
use crate::rsdm::disperse::{calc_uz, plume_rise, get_sigma_y, get_sigma_z, wind_components, C};
const AMBIENT_TEMP: f64 = 293.15; // Fixed ambient temperature [K] (20 C)
const BANDS: i32 = 10;
pub const TOLERANCE: f64 = 0.00000001;
/// ... | 29.916898 | 118 | 0.508611 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn model_run_test() {\n // Create new *RSDM and populate with fixed values (overwrite defaults)\n let mut dm = RSDM::new();\n \n dm.wspd = 2.0;\n dm.wdir = 130.0;\n dm.source.height = 10.0;\n dm.source.temp = 100.0;\n dm.pgcat =... |
f71812757957d597aefce82febd54737b35602bd | 5,676 | rs | Rust | src/transforms/sampler.rs | danpalmer/vector | b3554b16fa333727e21c8eaae87df4533e217c96 | [
"Apache-2.0"
] | null | null | null | src/transforms/sampler.rs | danpalmer/vector | b3554b16fa333727e21c8eaae87df4533e217c96 | [
"Apache-2.0"
] | 1 | 2020-02-25T22:48:56.000Z | 2020-02-26T19:29:43.000Z | src/transforms/sampler.rs | danpalmer/vector | b3554b16fa333727e21c8eaae87df4533e217c96 | [
"Apache-2.0"
] | 1 | 2019-12-18T01:08:03.000Z | 2019-12-18T01:08:03.000Z | use super::Transform;
use crate::{
event::{self, Event},
topology::config::{DataType, TransformConfig, TransformDescription},
};
use regex::RegexSet; // TODO: use regex::bytes
use serde::{Deserialize, Serialize};
use snafu::ResultExt;
use string_cache::DefaultAtom as Atom;
#[derive(Deserialize, Serialize, Debu... | 31.016393 | 99 | 0.57012 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn samples_at_roughly_the_configured_rate() {\n let num_events = 10000;\n\n let events = random_events(num_events);\n let mut sampler = Sampler::new(2, RegexSet::new(&[\"na\"]).unwrap());\n let total_passed = events\n ... |
f71839aaf1d4bc0585be8f501ba2937fefb6ce29 | 1,164 | rs | Rust | 009-Special_Pythagorean_triplet/rust/src/lib.rs | sthesing/learning-with-project-euler | 2850825039638512fd42c71b43250a4b8c3a7c94 | [
"WTFPL"
] | 1 | 2018-01-25T08:03:42.000Z | 2018-01-25T08:03:42.000Z | 009-Special_Pythagorean_triplet/rust/src/lib.rs | sthesing/learning-with-project-euler | 2850825039638512fd42c71b43250a4b8c3a7c94 | [
"WTFPL"
] | null | null | null | 009-Special_Pythagorean_triplet/rust/src/lib.rs | sthesing/learning-with-project-euler | 2850825039638512fd42c71b43250a4b8c3a7c94 | [
"WTFPL"
] | null | null | null | //! # Special Pythagorean triplet
//! A Pythagorean triplet is a set of three natural numbers, a < b < c, for which a²+b²=c²
//! There exists exactly one Pythagorean triplet for which a+b+c=1000
//! Find the product abc
//! ## Algebraic preparation
//!
//! We know three things:
//! 1. a<b<c
//! 2. a²+b²=c²
//! 3. a+b+... | 23.755102 | 90 | 0.504296 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn it_works() {\n }\n}"
] |
f7183f7c861bb1bfd05f3a1b39c0838c661a4cef | 17,027 | rs | Rust | common/cros_async/src/blocking/pool.rs | Horki/crosvm | b975546c3ffa05a65e6b725d39baad593cbd3052 | [
"BSD-3-Clause"
] | 1 | 2021-11-13T08:15:52.000Z | 2021-11-13T08:15:52.000Z | common/cros_async/src/blocking/pool.rs | baganda07/crosvm | c3dedf3cc1e45ff698e06d39171127b52021fda3 | [
"BSD-3-Clause"
] | null | null | null | common/cros_async/src/blocking/pool.rs | baganda07/crosvm | c3dedf3cc1e45ff698e06d39171127b52021fda3 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::{
collections::VecDeque,
mem,
sync::{
mpsc::{channel, Receiver, Sender},
Arc,
},
thread::{self, JoinHandle... | 32.556405 | 100 | 0.563282 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn blocking_sleep() {\n let pool = BlockingPool::default();\n\n let res = block_on(pool.spawn(|| 42));\n assert_eq!(res, 42);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fast_tasks_with_short_ke... |
f7185724def478d3c1377c137587e2dd36f3e9db | 50,331 | rs | Rust | mobilecoind/src/payments.rs | iamalwaysuncomfortable/mobilecoin | 9d7f88efe181ee498c07f62767ff56aed18a032c | [
"Apache-2.0"
] | null | null | null | mobilecoind/src/payments.rs | iamalwaysuncomfortable/mobilecoin | 9d7f88efe181ee498c07f62767ff56aed18a032c | [
"Apache-2.0"
] | null | null | null | mobilecoind/src/payments.rs | iamalwaysuncomfortable/mobilecoin | 9d7f88efe181ee498c07f62767ff56aed18a032c | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2018-2022 The MobileCoin Foundation
//! Construct and submit transactions to the validator network.
use crate::{database::Database, error::Error, monitor_store::MonitorId, utxo_store::UnspentTxOut};
use mc_account_keys::{AccountKey, PublicAddress};
use mc_common::{
logger::{log, o, Logger},
H... | 37.117257 | 134 | 0.579623 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_select_utxos_for_value_selects_smallest_inputs() {\n let mut utxos = generate_utxos(5);\n\n utxos[0].value = 100;\n utxos[1].value = 200;\n utxos[2].value = 300;\n utxos[3].value = 2000;\n utxos[4].valu... |
f7187c497b69eb7c9f9879e8e6fdfb42b182098e | 1,402 | rs | Rust | tests/expectations/tests/union-in-ns.rs | rust-lang-nursery/rust-bindgen | 5a01c551993e56d20240ef64d0ec78cd4195855d | [
"BSD-3-Clause"
] | 542 | 2017-07-25T23:16:15.000Z | 2018-11-21T19:44:15.000Z | tests/expectations/tests/union-in-ns.rs | servo/rust-bindgen | 5a01c551993e56d20240ef64d0ec78cd4195855d | [
"BSD-3-Clause"
] | 845 | 2016-06-22T21:55:20.000Z | 2018-10-31T15:50:10.000Z | tests/expectations/tests/union-in-ns.rs | rust-lang-nursery/rust-bindgen | 5a01c551993e56d20240ef64d0ec78cd4195855d | [
"BSD-3-Clause"
] | 113 | 2017-08-01T07:07:17.000Z | 2018-11-07T14:05:47.000Z | #![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
#[derive(Copy, Clone)]
pub union bar {
pub ba... | 25.962963 | 72 | 0.453638 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn bindgen_test_layout_bar() {\n assert_eq!(\n ::std::mem::size_of::<bar>(),\n 4usize,\n concat!(\"Size of: \", stringify!(bar))\n );\n assert_eq!(\n ::std::mem::align_of::<bar>(),\n ... |
f718acfe25b4b1b078bc8f81a6fd0499a2fbf5fd | 18,170 | rs | Rust | src/combinator.rs | fossabot/hoard | 2426ecfb2fa8bc6f6a568fa8c3dd10b2504717bf | [
"BSD-3-Clause"
] | 40 | 2021-06-04T08:38:57.000Z | 2022-03-08T13:32:27.000Z | src/combinator.rs | fossabot/hoard | 2426ecfb2fa8bc6f6a568fa8c3dd10b2504717bf | [
"BSD-3-Clause"
] | 100 | 2021-03-24T03:16:06.000Z | 2022-03-16T22:57:35.000Z | src/combinator.rs | fossabot/hoard | 2426ecfb2fa8bc6f6a568fa8c3dd10b2504717bf | [
"BSD-3-Clause"
] | 2 | 2021-08-30T02:55:16.000Z | 2022-01-27T07:19:44.000Z | //! A `Combinator` provides a *newtype* to parse a two-dimensional list of items as a collection of
//! AND-ed and OR-ed elements. Every item in the outer list is OR-ed, while every item in an inner list
//! is AND-ed. That is, for
//!
//! ```ignore
//! [ foo, bar, [baz, quux]]
//! ```
//!
//! The list will be parsed a... | 31.6 | 103 | 0.49202 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_inner() {\n let test_params = vec![\n (true, Inner::Single(Tester(true))),\n (false, Inner::Single(Tester(false))),\n // CombinatorInner::Multiple should AND all items\n (\n true... |
f718cc94cb0132bdd3f66c02e142cfc367d8de13 | 252 | rs | Rust | fuzzcheck/tests/option.rs | teymour-aldridge/fuzzcheck-rs | 534c3e05de5291f3890fef64904ca31848830b63 | [
"MIT"
] | null | null | null | fuzzcheck/tests/option.rs | teymour-aldridge/fuzzcheck-rs | 534c3e05de5291f3890fef64904ca31848830b63 | [
"MIT"
] | null | null | null | fuzzcheck/tests/option.rs | teymour-aldridge/fuzzcheck-rs | 534c3e05de5291f3890fef64904ca31848830b63 | [
"MIT"
] | null | null | null | use fuzzcheck::mutators::{integer::U8Mutator, option::OptionMutator};
#[test]
fn test_option() {
let m = OptionMutator::new(U8Mutator::default());
fuzzcheck::mutators::testing_utilities::test_mutator(m, 100.0, 100.0, false, true, 500, 500);
}
| 31.5 | 97 | 0.706349 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_option() {\n let m = OptionMutator::new(U8Mutator::default());\n fuzzcheck::mutators::testing_utilities::test_mutator(m, 100.0, 100.0, false, true, 500, 500);\n}\n}"
] |
f7192fd504b4c877ad1d8890ef0203025e570c78 | 10,788 | rs | Rust | consensus/src/chained_bft/consensus_types/block_test.rs | apemon/libra | 3ed9dff4c3f653ade22b1a403d8a0252a45bfb9a | [
"Apache-2.0"
] | null | null | null | consensus/src/chained_bft/consensus_types/block_test.rs | apemon/libra | 3ed9dff4c3f653ade22b1a403d8a0252a45bfb9a | [
"Apache-2.0"
] | null | null | null | consensus/src/chained_bft/consensus_types/block_test.rs | apemon/libra | 3ed9dff4c3f653ade22b1a403d8a0252a45bfb9a | [
"Apache-2.0"
] | null | null | null | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::chained_bft::{
common::{Height, Round},
consensus_types::{
block::{Block, BlockSource},
quorum_cert::QuorumCert,
},
test_utils::placeholder_certificate_for_block,
};
use crypto::{
ed25519... | 32.396396 | 98 | 0.62931 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_genesis() {\n // Test genesis and the next block\n let genesis_block = Block::<i64>::make_genesis_block();\n assert_eq!(genesis_block.height(), 0);\n assert_eq!(genesis_block.parent_id(), HashValue::zero());\n assert_ne!(genesis_... |
f719321c8dac34eabc3d0d9c78cd0870fe7d1fb8 | 3,016 | rs | Rust | noodles-sam/src/record/data/field/value/ty.rs | MaltheSR/noodles | 8530af08ced193795480ea8ee2667fe8af82bd92 | [
"MIT"
] | 201 | 2020-05-04T22:00:28.000Z | 2022-03-31T16:51:19.000Z | noodles-sam/src/record/data/field/value/ty.rs | kamenchunathan/noodles | aa3282a2c958b30123831416ec1a2312f5d809f7 | [
"MIT"
] | 75 | 2020-07-22T08:32:12.000Z | 2022-03-23T21:03:46.000Z | noodles-sam/src/record/data/field/value/ty.rs | kamenchunathan/noodles | aa3282a2c958b30123831416ec1a2312f5d809f7 | [
"MIT"
] | 28 | 2018-12-02T19:12:30.000Z | 2022-03-31T15:07:13.000Z | //! SAM record data field value type.
use std::{error, fmt, str::FromStr};
/// A SAM record data field value type.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Type {
/// Character (`A`).
Char,
/// Integer (`i`).
Int,
/// Single-precision floating-point (`f`).
Float,
/// String (`... | 26.45614 | 81 | 0.496353 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_fmt() {\n assert_eq!(Type::Char.to_string(), \"A\");\n assert_eq!(Type::Int.to_string(), \"i\");\n assert_eq!(Type::Float.to_string(), \"f\");\n assert_eq!(Type::String.to_string(), \"Z\");\n assert_eq!(Type::... |
f71968a2bbe842f4073b3dfd9cfc0b696868433b | 4,785 | rs | Rust | storage-proofs/porep/src/stacked/vanilla/challenges.rs | aliensero/filestar-rust-fil-proofs | f1ad6da1dea6e6cef0b2c6d6a9da3cd9bbe5a03d | [
"Apache-2.0",
"MIT"
] | 12 | 2020-12-03T08:11:18.000Z | 2021-09-01T02:28:46.000Z | storage-proofs/porep/src/stacked/vanilla/challenges.rs | aliensero/filestar-rust-fil-proofs | f1ad6da1dea6e6cef0b2c6d6a9da3cd9bbe5a03d | [
"Apache-2.0",
"MIT"
] | 1 | 2020-12-05T09:12:28.000Z | 2020-12-26T16:24:10.000Z | storage-proofs/porep/src/stacked/vanilla/challenges.rs | aliensero/filestar-rust-fil-proofs | f1ad6da1dea6e6cef0b2c6d6a9da3cd9bbe5a03d | [
"Apache-2.0",
"MIT"
] | 8 | 2021-01-15T12:33:34.000Z | 2021-12-31T11:21:34.000Z | use num_bigint::BigUint;
use num_traits::cast::ToPrimitive;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use storage_proofs_core::hasher::Domain;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LayerChallenges {
/// How many layers we are generating challenges for.
layers: usize... | 30.870968 | 111 | 0.553814 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn challenge_derivation() {\n let n = 200;\n let layers = 100;\n\n let challenges = LayerChallenges::new(layers, n);\n let leaves = 1 << 30;\n let rng = &mut thread_rng();\n let replica_id: Sha256Domain = Sha25... |
f71978c00af7111d395caca40bf3eeea08285eee | 6,792 | rs | Rust | src/coprocessor/util.rs | JoeWrightss/tikv | e2e9625a396cee537f7f9e83631452361e6f3caa | [
"Apache-2.0"
] | 3 | 2019-03-02T10:04:39.000Z | 2020-08-28T10:40:30.000Z | src/coprocessor/util.rs | JoeWrightss/tikv | e2e9625a396cee537f7f9e83631452361e6f3caa | [
"Apache-2.0"
] | null | null | null | src/coprocessor/util.rs | JoeWrightss/tikv | e2e9625a396cee537f7f9e83631452361e6f3caa | [
"Apache-2.0"
] | null | null | null | // Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... | 32.037736 | 97 | 0.497792 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_prefix_next() {\n test_prefix_next_once(&[], &[0]);\n test_prefix_next_once(&[0], &[1]);\n test_prefix_next_once(&[1], &[2]);\n test_prefix_next_once(&[255], &[255, 0]);\n test_prefix_next_once(&[255, 255, 255... |
f7198aa5cfb386a251b82028407c1bd6692b00c0 | 1,587 | rs | Rust | src/config/shadowsocks/method.rs | dumpmemory/mmp-rs2 | b6923fb55b14bda27f276bb124f550abdb8ac0ab | [
"MIT"
] | 1 | 2021-10-09T06:22:21.000Z | 2021-10-09T06:22:21.000Z | src/config/shadowsocks/method.rs | dumpmemory/mmp-rs2 | b6923fb55b14bda27f276bb124f550abdb8ac0ab | [
"MIT"
] | null | null | null | src/config/shadowsocks/method.rs | dumpmemory/mmp-rs2 | b6923fb55b14bda27f276bb124f550abdb8ac0ab | [
"MIT"
] | null | null | null | use serde::{Deserialize, Serialize};
/// Shadowsocks Encryption Methods.
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
pub enum Method {
#[serde(rename = "chacha20-ietf-poly1305")]
ChaCha20IETFPoly1305,
#[serde(rename = "aes-128-gcm")]
AES128GCM,
#[serde(rename = "aes-256-gcm")]
... | 33.0625 | 80 | 0.650284 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_deserialize() {\n let method = r#\"\"aes-128-gcm\"\"#;\n let deserialized_method: Method = serde_json::from_str(method).unwrap();\n assert_eq!(deserialized_method, Method::AES128GCM);\n\n let method = r#\"\"aes-256-g... |
f71a055bfca34455306b47d6c61c40e127f9df4e | 239 | rs | Rust | crates/widgets/src/vstack.rs | BSFishy/carton | 0edcde473e381d526eecb6777d20349ff751b7d3 | [
"MIT"
] | 1 | 2021-07-07T00:56:28.000Z | 2021-07-07T00:56:28.000Z | crates/widgets/src/vstack.rs | carton-rs/carton | 0edcde473e381d526eecb6777d20349ff751b7d3 | [
"MIT"
] | 17 | 2020-12-03T16:24:14.000Z | 2020-12-04T15:25:07.000Z | crates/widgets/src/vstack.rs | carton-rs/carton | 0edcde473e381d526eecb6777d20349ff751b7d3 | [
"MIT"
] | null | null | null | //! TODO: document this
pub struct VStack<T> {
#[allow(unused)]
views: T,
}
// macro_rules! vstack {
// () => {
//
// }
// }
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4)
}
}
| 10.863636 | 28 | 0.447699 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn it_works() {\n assert_eq!(2 + 2, 4)\n }\n}"
] |
f71a2e29ed6d934c64543efb9f5d0b267a59d886 | 2,170 | rs | Rust | feel-parser/src/tests/if_expression.rs | dmntk/dmntk.rs | 3b8a2bd4bec8aec7b2efe020c543b95710bdf1cd | [
"Apache-2.0",
"MIT"
] | 6 | 2021-12-03T10:11:33.000Z | 2022-03-31T13:13:29.000Z | feel-parser/src/tests/if_expression.rs | dmntk/dmntk.rs | 3b8a2bd4bec8aec7b2efe020c543b95710bdf1cd | [
"Apache-2.0",
"MIT"
] | 28 | 2022-01-11T15:08:40.000Z | 2022-01-31T08:24:13.000Z | feel-parser/src/tests/if_expression.rs | dmntk/dmntk.rs | 3b8a2bd4bec8aec7b2efe020c543b95710bdf1cd | [
"Apache-2.0",
"MIT"
] | null | null | null | /*
* DMNTK - Decision Model and Notation Toolkit
*
* MIT license
*
* Copyright (c) 2018-2022 Dariusz Depta Engos Software
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE ... | 25.529412 | 80 | 0.611982 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn _0001() {\n let scope = scope!();\n accept(\n &scope,\n StartTextualExpression,\n \"if 1 > 2 then 5 else 8\",\n r#\"\n If\n ├─ Gt\n │ ├─ Numeric\n │ │ └─ `1.`\n │ └─ Numeric\n │ └─ `2.`\n ... |
f71a4b01c73859c42c341dfa8e703b6f57acf8fc | 5,191 | rs | Rust | src/data/expression/ast.rs | mathstuf/rust-bulletml | b3ce31f2c702581dc476bd8d61a377b7d4622424 | [
"BSD-2-Clause"
] | null | null | null | src/data/expression/ast.rs | mathstuf/rust-bulletml | b3ce31f2c702581dc476bd8d61a377b7d4622424 | [
"BSD-2-Clause"
] | 4 | 2019-01-17T16:30:30.000Z | 2019-07-10T13:32:48.000Z | src/data/expression/ast.rs | mathstuf/rust-bulletml | b3ce31f2c702581dc476bd8d61a377b7d4622424 | [
"BSD-2-Clause"
] | null | null | null | // Distributed under the OSI-approved BSD 2-Clause License.
// See accompanying LICENSE file for details.
use crate::data::expression::Value;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ExprVar {
Rank,
Rand,
Named(String),
Param(usize),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Unar... | 24.032407 | 88 | 0.467733 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_constant_folding_unary() {\n let expr = parse(\"-4\").constant_fold();\n check_literal(expr, -4.);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_constant_folding_binops() {\n let expr... |
f71a71672311b5d428b47b17d665ee05d08c1fdd | 14,396 | rs | Rust | src/transport/async/active/unix.rs | blabaere/scaproust | 8a73fac28d3e78b3c641ddb87661f8a41ad7677e | [
"Apache-2.0",
"MIT"
] | 204 | 2015-12-18T21:38:51.000Z | 2022-02-11T17:38:43.000Z | src/transport/async/active/unix.rs | blabaere/scaproust | 8a73fac28d3e78b3c641ddb87661f8a41ad7677e | [
"Apache-2.0",
"MIT"
] | 15 | 2016-11-06T18:15:55.000Z | 2018-06-07T19:44:04.000Z | src/transport/async/active/unix.rs | blabaere/scaproust | 8a73fac28d3e78b3c641ddb87661f8a41ad7677e | [
"Apache-2.0",
"MIT"
] | 8 | 2015-09-27T09:45:55.000Z | 2021-01-14T02:11:11.000Z | // Copyright (c) 2015-2017 Contributors as noted in the AUTHORS file.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, o... | 33.872941 | 112 | 0.588844 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn on_enter_stub_is_reregistered_and_an_event_is_raised() {\n let sensor_srv = TestStepStreamSensor::new();\n let sensor = Rc::new(RefCell::new(sensor_srv));\n let stub = TestStepStream::with_sensor(sensor.clone());\n let mu... |
f71a76e9e0a01785d54c64800d644e6cddd7ff01 | 11,190 | rs | Rust | src/sys/timekeeper/src/main.rs | sysidos/fuchsia | 0c00fd3c78a9c0111af4689f1e038b3926c4dc9b | [
"BSD-3-Clause"
] | null | null | null | src/sys/timekeeper/src/main.rs | sysidos/fuchsia | 0c00fd3c78a9c0111af4689f1e038b3926c4dc9b | [
"BSD-3-Clause"
] | null | null | null | src/sys/timekeeper/src/main.rs | sysidos/fuchsia | 0c00fd3c78a9c0111af4689f1e038b3926c4dc9b | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![warn(missing_docs)]
//! `timekeeper` is responsible for external time synchronization in Fuchsia.
use {
anyhow::{Context as _, Error},
chrono:... | 38.061224 | 98 | 0.622788 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fixed_backstop_check() {\n let y2k_backstop = \"/pkg/data/y2k\";\n let test_backstop = backstop_time(y2k_backstop.as_ref()).unwrap();\n let test_source = initial_utc_source(y2k_backstop.as_ref()).unwrap();\n let before_te... |
f71a780aacf026fad53556a1b9de533de1466b22 | 1,512 | rs | Rust | src/test.rs | hioki/gatekeeper | 90f4fcf40fe6be0a45f35d96d2c8aa4e61d087ea | [
"Apache-2.0"
] | 2 | 2020-04-16T19:58:31.000Z | 2021-08-28T14:42:57.000Z | src/test.rs | hioki/gatekeeper | 90f4fcf40fe6be0a45f35d96d2c8aa4e61d087ea | [
"Apache-2.0"
] | 18 | 2020-04-09T06:31:22.000Z | 2021-02-22T05:15:10.000Z | src/test.rs | hioki/gatekeeper | 90f4fcf40fe6be0a45f35d96d2c8aa4e61d087ea | [
"Apache-2.0"
] | 2 | 2020-08-06T07:45:38.000Z | 2021-08-28T14:47:12.000Z | #![cfg(test)]
use std::path::PathBuf;
#[test]
#[ignore]
fn get_main() {
use std::io::prelude::*;
use log::*;
use regex::Regex;
use socks::*;
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
println!("root: {}", root.display());
let exp = std::fs::read_to_string(root.join("src/main.r... | 28.528302 | 73 | 0.509259 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn get_main() {\n use std::io::prelude::*;\n\n use log::*;\n use regex::Regex;\n use socks::*;\n\n let root = PathBuf::from(env!(\"CARGO_MANIFEST_DIR\"));\n println!(\"root: {}\", root.display());\n\n let exp = std::fs::read_to_string(... |
f71a7a749124b5775d332b3fe02188c07a453498 | 1,809 | rs | Rust | src/decorators/inline.rs | mkantor/handlebars-rust | 792880a3d29d6cced317f264103dbd6ea2b46671 | [
"MIT"
] | null | null | null | src/decorators/inline.rs | mkantor/handlebars-rust | 792880a3d29d6cced317f264103dbd6ea2b46671 | [
"MIT"
] | null | null | null | src/decorators/inline.rs | mkantor/handlebars-rust | 792880a3d29d6cced317f264103dbd6ea2b46671 | [
"MIT"
] | null | null | null | use crate::context::Context;
use crate::decorators::{DecoratorDef, DecoratorResult};
use crate::error::RenderError;
use crate::registry::Registry;
use crate::render::{Decorator, RenderContext};
#[derive(Clone, Copy)]
pub struct InlineDecorator;
fn get_name<'reg: 'rc, 'rc>(d: &Decorator<'reg, 'rc>) -> Result<String, R... | 27.409091 | 91 | 0.569375 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_inline() {\n let t0 = Template::compile(\n \"{{#*inline \\\"hello\\\"}}the hello world inline partial.{{/inline}}\".to_string(),\n )\n .ok()\n .unwrap();\n\n let hbs = Registry::new();\n\n le... |
f71a802590cca79e7b0724a5b155ccefe37aac7f | 21,944 | rs | Rust | sgx/num-rational-sgx-test/enclave/src/tests.rs | mathias-arm/num-rational | 87fd5b9fae798679d22d35b3d16e8edb7ceba1d0 | [
"Apache-2.0",
"MIT"
] | null | null | null | sgx/num-rational-sgx-test/enclave/src/tests.rs | mathias-arm/num-rational | 87fd5b9fae798679d22d35b3d16e8edb7ceba1d0 | [
"Apache-2.0",
"MIT"
] | null | null | null | sgx/num-rational-sgx-test/enclave/src/tests.rs | mathias-arm/num-rational | 87fd5b9fae798679d22d35b3d16e8edb7ceba1d0 | [
"Apache-2.0",
"MIT"
] | 1 | 2020-11-09T15:35:30.000Z | 2020-11-09T15:35:30.000Z | use std::prelude::v1::*;
use std::hash::*;
fn hash<T: Hash>(x: &T) -> u64 {
use std::collections::hash_map::RandomState;
let mut hasher = <RandomState as BuildHasher>::Hasher::new();
x.hash(&mut hasher);
hasher.finish()
}
//#[cfg(feature = "bigint")]
use num_rational::BigRational;
use num_rational::{R... | 28.949868 | 79 | 0.526704 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_new_zero() {\n let _a = Ratio::new(1, 0);\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_recip_fail() {\n let _a = Ratio::new(0, 1).recip();\n}\n}"
] |
f71a948b01d4903c4a6afe6d1ae1427e30df0910 | 27,114 | rs | Rust | crates/spelldawn/tests/it/core/raid_tests.rs | thurn/Spelldawn | e8782eb5b032fa550ac63e66f3f931b3f7e0bd73 | [
"Apache-2.0"
] | 1 | 2021-12-30T19:13:53.000Z | 2021-12-30T19:13:53.000Z | crates/spelldawn/tests/it/core/raid_tests.rs | thurn/Spelldawn | e8782eb5b032fa550ac63e66f3f931b3f7e0bd73 | [
"Apache-2.0"
] | null | null | null | crates/spelldawn/tests/it/core/raid_tests.rs | thurn/Spelldawn | e8782eb5b032fa550ac63e66f3f931b3f7e0bd73 | [
"Apache-2.0"
] | null | null | null | // Copyright © Spelldawn 2021-present
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to i... | 35.167315 | 89 | 0.65811 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn initiate_raid() {\n let (mut g, ids) = test_games::simple_game(\n Side::Champion,\n CardName::TestScheme31,\n CardName::TestMinionEndRaid,\n CardName::TestWeapon3Attack12Boost3Cost,\n );\n let response = g.perfor... |
f71a956804bb0c7267ca30227ac4bfd83928630d | 876 | rs | Rust | raylib-test/src/models.rs | mlambir/raylib-rs | 731b0c4700bdce7b2552a70a9abdcdef4de35aa8 | [
"Zlib"
] | null | null | null | raylib-test/src/models.rs | mlambir/raylib-rs | 731b0c4700bdce7b2552a70a9abdcdef4de35aa8 | [
"Zlib"
] | null | null | null | raylib-test/src/models.rs | mlambir/raylib-rs | 731b0c4700bdce7b2552a70a9abdcdef4de35aa8 | [
"Zlib"
] | null | null | null | #[cfg(test)]
mod model_test {
use crate::tests::*;
use raylib::prelude::*;
ray_test!(test_load_model);
fn test_load_model(thread: &RaylibThread) {
let mut handle = TEST_HANDLE.write().unwrap();
let rl = handle.as_mut().unwrap();
let _ = rl.load_model(thread, "resources/cube.obj"... | 32.444444 | 102 | 0.635845 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_load_anims() {\n let _ = ModelAnimation::load_model_animations(\"resources/guy/guyanim.iqm\")\n .expect(\"could not load model animations\");\n }\n}"
] |
f71aab144b065e04db6af27eb9f244028e50688d | 15,024 | rs | Rust | block-sys/src/lib.rs | madsmtm/objc2 | 1c9c9d375dbd89cc3fea0f88d78940e730a59d99 | [
"MIT"
] | 16 | 2021-11-22T22:31:44.000Z | 2022-03-20T08:42:28.000Z | block-sys/src/lib.rs | madsmtm/objc2 | 1c9c9d375dbd89cc3fea0f88d78940e730a59d99 | [
"MIT"
] | 26 | 2021-11-26T00:58:58.000Z | 2022-03-29T14:44:39.000Z | block-sys/src/lib.rs | madsmtm/objc2 | 1c9c9d375dbd89cc3fea0f88d78940e730a59d99 | [
"MIT"
] | 1 | 2021-12-22T16:20:51.000Z | 2021-12-22T16:20:51.000Z | //! # Raw bindings to Apple's C language extension of blocks
//!
//! The documentation for these bindings is a mix from GNUStep's and Apple's
//! sources, but the [ABI specification][ABI] is really the place you should
//! be looking!
//!
//! See also the [`README.md`](https://crates.io/crates/block-sys) for more
//! b... | 34.145455 | 105 | 0.674188 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn smoke() {\n assert_eq!(unsafe { _Block_copy(ptr::null()) }, ptr::null_mut());\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_linkable() {\n println!(\"{:p}\", unsafe { &_NSConcreteGlobalBlock });\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.