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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f700019f6cc8e4d84dab4aa28137258fd5f3bf7d | 11,234 | rs | Rust | src/impls/memory.rs | Zyian/rust-vfs | 40fe15a947479054d98b8303f11db123ffd723cc | [
"Apache-2.0"
] | null | null | null | src/impls/memory.rs | Zyian/rust-vfs | 40fe15a947479054d98b8303f11db123ffd723cc | [
"Apache-2.0"
] | null | null | null | src/impls/memory.rs | Zyian/rust-vfs | 40fe15a947479054d98b8303f11db123ffd723cc | [
"Apache-2.0"
] | null | null | null | //! An ephemeral in-memory file system, intended mainly for unit tests
use crate::{FileSystem, VfsFileType};
use crate::{SeekAndRead, VfsMetadata};
use crate::{VfsError, VfsResult};
use core::cmp;
use std::collections::HashMap;
use std::fmt;
use std::fmt::{Debug, Formatter};
use std::io::{Cursor, Read, Seek, SeekFrom,... | 29.798408 | 148 | 0.527951 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn write_and_read_file() -> VfsResult<()> {\n let root = VfsPath::new(MemoryFS::new());\n let path = root.join(\"foobar.txt\").unwrap();\n let _send = &path as &dyn Send;\n {\n let mut file = path.create_file().un... |
f700b4631291779bac31279265cd69455dcacb17 | 899 | rs | Rust | src/ppu/control_register/spec_tests.rs | planet-s/rs-nes | d6e15726b30b17736df990762165d541b43394b7 | [
"MIT"
] | 103 | 2016-12-06T17:14:33.000Z | 2021-09-09T16:42:24.000Z | src/ppu/control_register/spec_tests.rs | planet-s/rs-nes | d6e15726b30b17736df990762165d541b43394b7 | [
"MIT"
] | 15 | 2015-07-27T01:20:30.000Z | 2019-01-20T20:42:56.000Z | src/ppu/control_register/spec_tests.rs | planet-s/rs-nes | d6e15726b30b17736df990762165d541b43394b7 | [
"MIT"
] | 3 | 2017-10-11T01:45:05.000Z | 2020-07-24T07:58:57.000Z | use super::*;
#[test]
fn vram_addr_increment() {
let ppu_ctrl = new_control_register(0b00000000);
assert_eq!(IncrementAmount::One, ppu_ctrl.vram_addr_increment());
let ppu_ctrl = new_control_register(0b00000100);
assert_eq!(IncrementAmount::ThirtyTwo, ppu_ctrl.vram_addr_increment());
}
#[test]
fn spr... | 27.242424 | 75 | 0.734149 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn vram_addr_increment() {\n let ppu_ctrl = new_control_register(0b00000000);\n assert_eq!(IncrementAmount::One, ppu_ctrl.vram_addr_increment());\n\n let ppu_ctrl = new_control_register(0b00000100);\n assert_eq!(IncrementAmount::ThirtyTwo, ... |
f700b7fd9eddfed7dd46360828c9f9a5d963a15f | 1,422 | rs | Rust | crates/category/tests/find.rs | Nertsal/categories | 3fd0a8b4f5c9a3df78c35126bb4af3a9ed10bae3 | [
"MIT"
] | 1 | 2021-11-14T14:33:37.000Z | 2021-11-14T14:33:37.000Z | crates/category/tests/find.rs | Nertsal/categories | 3fd0a8b4f5c9a3df78c35126bb4af3a9ed10bae3 | [
"MIT"
] | 11 | 2021-11-14T19:09:44.000Z | 2022-03-23T17:08:52.000Z | crates/category/tests/find.rs | Nertsal/categories | 3fd0a8b4f5c9a3df78c35126bb4af3a9ed10bae3 | [
"MIT"
] | null | null | null | use category::constraint::ConstraintsBuilder;
use category::prelude::*;
use category::{Bindings, CategoryBuilder};
#[test]
fn test_find() {
let category = CategoryBuilder::<(), (), (), &str>::new()
.object("A", vec![], ())
.object("B", vec![], ())
.object("AxB", vec![ObjectTag::Product("A",... | 33.069767 | 77 | 0.483122 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_find() {\n let category = CategoryBuilder::<(), (), (), &str>::new()\n .object(\"A\", vec![], ())\n .object(\"B\", vec![], ())\n .object(\"AxB\", vec![ObjectTag::Product(\"A\", \"B\")], ())\n .morphism(\"p1\", \"A... |
f700c24903be957b81cc4024bba608c4c4f3039a | 4,655 | rs | Rust | crypto-ws-client/tests/bybit.rs | xermicus/crypto-crawler-rs | d594bcdcd7aef1b3085dc3270ec398f089b4d66d | [
"Apache-2.0"
] | 68 | 2020-12-31T07:13:11.000Z | 2022-03-23T03:36:51.000Z | crypto-ws-client/tests/bybit.rs | xermicus/crypto-crawler-rs | d594bcdcd7aef1b3085dc3270ec398f089b4d66d | [
"Apache-2.0"
] | 13 | 2021-11-11T19:53:06.000Z | 2022-03-12T11:55:42.000Z | crypto-ws-client/tests/bybit.rs | xermicus/crypto-crawler-rs | d594bcdcd7aef1b3085dc3270ec398f089b4d66d | [
"Apache-2.0"
] | 22 | 2021-01-02T14:14:14.000Z | 2022-03-19T19:27:27.000Z | #[macro_use]
mod utils;
#[cfg(test)]
mod bybit_inverse_future {
use crypto_ws_client::{BybitInverseFutureWSClient, WSClient};
use std::sync::mpsc::{Receiver, Sender};
#[test]
fn subscribe() {
gen_test_code!(
BybitInverseFutureWSClient,
subscribe,
&vec!["trad... | 23.159204 | 81 | 0.53319 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn subscribe() {\n gen_test_code!(\n BybitInverseFutureWSClient,\n subscribe,\n &vec![\"trade.BTCUSDZ21\".to_string()]\n );\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn ... |
f700c3da5c347ccb3bff98f4b254376ca3b73b71 | 2,711 | rs | Rust | tests/query.rs | SimonSapin/warp | 6d21e73ac2de6205ee233e4287ff7b52f77b3664 | [
"MIT"
] | null | null | null | tests/query.rs | SimonSapin/warp | 6d21e73ac2de6205ee233e4287ff7b52f77b3664 | [
"MIT"
] | null | null | null | tests/query.rs | SimonSapin/warp | 6d21e73ac2de6205ee233e4287ff7b52f77b3664 | [
"MIT"
] | null | null | null | #![deny(warnings)]
extern crate warp;
#[macro_use]
extern crate serde_derive;
use std::collections::HashMap;
use warp::Filter;
#[test]
fn query() {
let as_map = warp::query::<HashMap<String, String>>();
let req = warp::test::request().path("/?foo=bar&baz=quux");
let extracted = req.filter(&as_map).unwra... | 21.515873 | 75 | 0.582811 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn query() {\n let as_map = warp::query::<HashMap<String, String>>();\n\n let req = warp::test::request().path(\"/?foo=bar&baz=quux\");\n\n let extracted = req.filter(&as_map).unwrap();\n assert_eq!(extracted[\"foo\"], \"bar\");\n assert... |
f7010908986b983516c0c14e2e8db609547e7532 | 1,376 | rs | Rust | rust-playground/unionfind/src/quickfind.rs | sravyapulavarthi/algorithm-playground | 331fd3eeb4459afe871c36d80f8d01e5002e747a | [
"MIT"
] | 85 | 2017-12-19T19:51:51.000Z | 2021-05-26T20:00:39.000Z | rust-playground/unionfind/src/quickfind.rs | sangeetha77/algorithm-playground | 331fd3eeb4459afe871c36d80f8d01e5002e747a | [
"MIT"
] | 1 | 2019-01-02T07:00:40.000Z | 2019-01-02T07:00:40.000Z | rust-playground/unionfind/src/quickfind.rs | sangeetha77/algorithm-playground | 331fd3eeb4459afe871c36d80f8d01e5002e747a | [
"MIT"
] | 34 | 2018-03-29T11:51:53.000Z | 2020-11-17T08:24:51.000Z | use UnionFind;
#[derive(Debug)]
pub struct QuickFind {
pub n: usize,
pub id: Vec<usize>,
}
impl UnionFind for QuickFind {
fn new(n: usize) -> Self {
let id: Vec<usize> = (0..n).collect();
QuickFind { n, id }
}
fn connected(&mut self, p: usize, q: usize) -> bool {
self.id... | 19.380282 | 61 | 0.43968 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_simple_connected() {\n\n let mut q = QuickFind::new(10);\n \n let i = q.connected(4, 7);\n let j = q.connected(3, 6);\n let k = q.connected(1, 2);\n \n assert!(!i);\n assert!(!j);\n ... |
f7011be990eed39c7e23a73ecec42804e16e4392 | 4,748 | rs | Rust | src/tests.rs | xemwebe/argmin | 77697603314afac948a6603f870f1ae32f05e2e1 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/tests.rs | xemwebe/argmin | 77697603314afac948a6603f870f1ae32f05e2e1 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/tests.rs | xemwebe/argmin | 77697603314afac948a6603f870f1ae32f05e2e1 | [
"Apache-2.0",
"MIT"
] | null | null | null | // Copyright 2019-2020 argmin developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://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, or distributed except according... | 32.29932 | 91 | 0.606361 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_lbfgs_func_count() {\n let cost = MaxEntropy::new();\n\n let linesearch = MoreThuenteLineSearch::new();\n let solver = LBFGS::new(linesearch, 10);\n let res = Executor::new(cost.clone(), solver, cost.param_init.clone())\n .ma... |
f7016ec1c8cf24eecaa5a0e4f950b5a2a20954df | 1,377 | rs | Rust | tests/expectations/tests/ctypes-prefix-path.rs | JRF63/rust-bindgen | cb8266620596222b1cd9dbe6551cc1e3e8bb7f72 | [
"BSD-3-Clause"
] | 1 | 2021-01-07T18:48:18.000Z | 2021-01-07T18:48:18.000Z | tests/expectations/tests/ctypes-prefix-path.rs | JRF63/rust-bindgen | cb8266620596222b1cd9dbe6551cc1e3e8bb7f72 | [
"BSD-3-Clause"
] | 3 | 2016-05-31T14:38:04.000Z | 2016-07-18T21:18:09.000Z | tests/expectations/tests/ctypes-prefix-path.rs | JRF63/rust-bindgen | cb8266620596222b1cd9dbe6551cc1e3e8bb7f72 | [
"BSD-3-Clause"
] | 2 | 2016-05-30T18:46:14.000Z | 2016-06-01T08:14:25.000Z | /* automatically generated by rust-bindgen */
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![no_std]
mod libc {
pub mod foo {
pub type c_int = i32;
pub enum c_void {}
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct foo {
pub ... | 24.157895 | 77 | 0.525054 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn bindgen_test_layout_foo() {\n assert_eq!(\n ::core::mem::size_of::<foo>(),\n 16usize,\n concat!(\"Size of: \", stringify!(foo))\n );\n assert_eq!(\n ::core::mem::align_of::<foo>(),\n 8usize,\n conca... |
f701853727620eb267dc35f65b9a824f16eacb7c | 1,016 | rs | Rust | tests/match.rs | tcr/hoodlum | e0e1416ecea7ec58a71bcdd7571afe3e426af4b1 | [
"Apache-2.0",
"MIT"
] | 102 | 2016-08-19T13:02:42.000Z | 2022-03-04T22:09:57.000Z | tests/match.rs | tcr/hoodlum | e0e1416ecea7ec58a71bcdd7571afe3e426af4b1 | [
"Apache-2.0",
"MIT"
] | 30 | 2016-11-04T21:49:29.000Z | 2018-11-16T14:29:33.000Z | tests/match.rs | tcr/hoodlum | e0e1416ecea7ec58a71bcdd7571afe3e426af4b1 | [
"Apache-2.0",
"MIT"
] | 5 | 2016-10-17T07:06:51.000Z | 2020-01-23T00:48:57.000Z | extern crate hoodlum;
use hoodlum::*;
#[test]
fn match_or() {
let code = r#"
match a {
0 | 1 => { }
_ => { }
}
"#;
let valid = r#"
case (a)
0, 1: begin
end
default: begin
end
endcase
"#;
let res = parse_results(code, hoodlum::hdl_parser::parse_SeqStatement(code));
let out = r... | 14.941176 | 81 | 0.556102 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn match_or() {\n let code = r#\"\nmatch a {\n 0 | 1 => { }\n _ => { }\n}\n\"#;\n\n let valid = r#\"\ncase (a)\n 0, 1: begin\n end\n default: begin\n end\nendcase\n\"#;\n\n let res = parse_results(code, hoodlum::hdl_parser::p... |
f70194552609ff6af8171b4e07459adf6d772449 | 13,731 | rs | Rust | amethyst_rendy/src/batch.rs | lambdaxymox/amethyst | 698ca6736f5a35cfed9ee73fccce1780e783ea4c | [
"MIT"
] | null | null | null | amethyst_rendy/src/batch.rs | lambdaxymox/amethyst | 698ca6736f5a35cfed9ee73fccce1780e783ea4c | [
"MIT"
] | null | null | null | amethyst_rendy/src/batch.rs | lambdaxymox/amethyst | 698ca6736f5a35cfed9ee73fccce1780e783ea4c | [
"MIT"
] | null | null | null | //! Module containing structures useful for batching draw calls
//! in scenarios with various known assumptions, e.g. order independence.
use std::{
collections::hash_map::Entry,
iter::{Extend, FromIterator},
ops::Range,
};
use derivative::Derivative;
use smallvec::{smallvec, SmallVec};
#[cfg(feature = "pr... | 32.156909 | 100 | 0.57738 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_ordered_onelevel_batch_single_insert() {\n let mut batch = OrderedOneLevelBatch::<u32, u32>::default();\n batch.insert(0, Some(0));\n assert_eq!(batch.count(), 1);\n assert_eq!(batch.iter().collect::<Vec<_>>(), vec![... |
f701a7312a3bcea3ecd9bfd2bf7fa634a8eba26c | 69,192 | rs | Rust | src/sys/socket/mod.rs | sporksmith/nix | 4d8504bee10778d37a804f812e865d7440f2c3b9 | [
"MIT"
] | null | null | null | src/sys/socket/mod.rs | sporksmith/nix | 4d8504bee10778d37a804f812e865d7440f2c3b9 | [
"MIT"
] | null | null | null | src/sys/socket/mod.rs | sporksmith/nix | 4d8504bee10778d37a804f812e865d7440f2c3b9 | [
"MIT"
] | null | null | null | //! Socket interface functions
//!
//! [Further reading](https://man7.org/linux/man-pages/man7/socket.7.html)
use cfg_if::cfg_if;
use crate::{Error, Result, errno::Errno};
use libc::{self, c_void, c_int, iovec, socklen_t, size_t,
CMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_LEN};
use memoffset::offset_of;
use st... | 36.706631 | 130 | 0.581397 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn can_use_cmsg_space() {\n let _ = cmsg_space!(u8);\n }\n}"
] |
f701cc09ffa27d21e22cd3cddb86c098ad91ff22 | 9,309 | rs | Rust | src/util.rs | alpearce/rust-tuf | 4d4fa7330ba105481c0c4018a57e15efdb27be98 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/util.rs | alpearce/rust-tuf | 4d4fa7330ba105481c0c4018a57e15efdb27be98 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/util.rs | alpearce/rust-tuf | 4d4fa7330ba105481c0c4018a57e15efdb27be98 | [
"Apache-2.0",
"MIT"
] | null | null | null | use chrono::offset::Utc;
use chrono::DateTime;
use futures_io::AsyncRead;
use futures_util::ready;
use ring::digest::{self, SHA256, SHA512};
use std::io::{self, ErrorKind};
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{Context, Poll};
use crate::crypto::{HashAlgorithm, HashValue};
use crate::error::Error;... | 34.350554 | 99 | 0.520034 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn valid_read() {\n block_on(async {\n let bytes: &[u8] = &[0x00, 0x01, 0x02, 0x03];\n let mut reader = SafeReader::new(bytes, bytes.len() as u64, 0, None).unwrap();\n let mut buf = Vec::new();\n asser... |
f7023ef38590c3d50f3eb561efad5d6f442fdacb | 9,332 | rs | Rust | src/serialization/v1.rs | akkoro/macaroon | 6015828846f11251248fcdd717e015c33bab8b70 | [
"MIT"
] | 14 | 2020-05-26T07:49:44.000Z | 2022-01-16T22:16:03.000Z | src/serialization/v1.rs | akkoro/macaroon | 6015828846f11251248fcdd717e015c33bab8b70 | [
"MIT"
] | 40 | 2020-05-11T11:34:28.000Z | 2022-03-23T12:19:48.000Z | src/serialization/v1.rs | akkoro/macaroon | 6015828846f11251248fcdd717e015c33bab8b70 | [
"MIT"
] | 5 | 2020-09-10T08:15:16.000Z | 2021-10-31T05:44:25.000Z | use caveat::{Caveat, CaveatBuilder};
use error::MacaroonError;
use serialization::macaroon_builder::MacaroonBuilder;
use std::str;
use ByteString;
use Macaroon;
use Result;
// Version 1 fields
const LOCATION: &str = "location";
const IDENTIFIER: &str = "identifier";
const SIGNATURE: &str = "signature";
const CID: &str... | 38.561983 | 230 | 0.583155 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_deserialize() {\n let mut serialized = \"MDAyMWxvY2F0aW9uIGh0dHA6Ly9leGFtcGxlLm9yZy8KMDAxNWlkZW50aWZpZXIga2V5aWQKMDAyZnNpZ25hdHVyZSB83ueSURxbxvUoSFgF3-myTnheKOKpkwH51xHGCeOO9wo\";\n let mut signature: MacaroonKey = [\n ... |
f70262df02c7d1c2e8c07a1c139c588f5708a655 | 10,018 | rs | Rust | third-party/RustaCUDA/src/module.rs | fossabot/necsim-rust | 996b6a6977bc27a997a123e3e4f5a7b11e1a1aef | [
"Apache-2.0",
"MIT"
] | null | null | null | third-party/RustaCUDA/src/module.rs | fossabot/necsim-rust | 996b6a6977bc27a997a123e3e4f5a7b11e1a1aef | [
"Apache-2.0",
"MIT"
] | null | null | null | third-party/RustaCUDA/src/module.rs | fossabot/necsim-rust | 996b6a6977bc27a997a123e3e4f5a7b11e1a1aef | [
"Apache-2.0",
"MIT"
] | null | null | null | //! Functions and types for working with CUDA modules.
use crate::{
error::{CudaResult, DropResult, IntoResult},
function::Function,
memory::{CopyDestination, DeviceCopy, DevicePointer},
};
use cuda_driver_sys as cuda;
use std::{
ffi::{c_void, CStr},
fmt,
marker::PhantomData,
mem, ptr,
};
... | 29.994012 | 94 | 0.50539 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_load_from_file() -> Result<(), Box<dyn Error>> {\n let _context = quick_init();\n\n let filename = CString::new(\"./resources/add.ptx\")?;\n let module = Module::load_from_file(&filename)?;\n drop(module);\n O... |
f702ab0b22e585a7973fceb4875d1617be3b947c | 8,766 | rs | Rust | src/names/ncname.rs | lo48576/xml-string | dd589ba6216e33b72f88f2ad7add3a92a3b21c54 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/names/ncname.rs | lo48576/xml-string | dd589ba6216e33b72f88f2ad7add3a92a3b21c54 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/names/ncname.rs | lo48576/xml-string | dd589ba6216e33b72f88f2ad7add3a92a3b21c54 | [
"Apache-2.0",
"MIT"
] | null | null | null | //! [`NCName`].
//!
//! [`NCName`]: https://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName
use core::convert::TryFrom;
use crate::names::chars;
use crate::names::error::{NameError, TargetNameType};
use crate::names::{Eqname, Name, Nmtoken, Qname};
/// String slice for [`NCName`].
///
/// [`NCName`]: https://ww... | 28.186495 | 101 | 0.509354 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn ncname_str_valid() {\n ensure_eq(\"hello\");\n ensure_eq(\"abc123\");\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn ncname_str_invalid() {\n ensure_error_at(\"\", 0);\n ensure_error_at(\... |
f702dfcd3ce66614a66e15b03e3171137bff0239 | 535 | rs | Rust | jimmys-first-rust-lambda/src/main.rs | JimTheMan/Jimmys-First-Serverless-Rust-Lambda | f6bc5d3871758ac2921e0dabea11bda37f2e34ee | [
"MIT"
] | null | null | null | jimmys-first-rust-lambda/src/main.rs | JimTheMan/Jimmys-First-Serverless-Rust-Lambda | f6bc5d3871758ac2921e0dabea11bda37f2e34ee | [
"MIT"
] | null | null | null | jimmys-first-rust-lambda/src/main.rs | JimTheMan/Jimmys-First-Serverless-Rust-Lambda | f6bc5d3871758ac2921e0dabea11bda37f2e34ee | [
"MIT"
] | null | null | null | use lambda_runtime::{error::HandlerError, lambda, Context};
use serde_json::Value;
fn main() {
lambda!(handler)
}
fn handler(
event: Value,
_: Context,
) -> Result<Value, HandlerError> {
Ok(event)
}
#[cfg(test)]
mod tests {
use super::*;
use serde_json::json;
#[test]
fn handler_handl... | 17.258065 | 86 | 0.540187 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn handler_handles() {\n let event = json!({\n \"answer\": 42\n });\n assert_eq!(\n handler(event.clone(), Context::default()).expect(\"expected Ok(_) value\"),\n event\n )\n }\n}"
] |
f702fe1374da6122b5dbaeb021f1afa7c72552f4 | 28,698 | rs | Rust | src/manifest.rs | nickbabcock/cargo-deb | c8fbe560126afaef95770fc2e1338172bc8df45c | [
"MIT"
] | null | null | null | src/manifest.rs | nickbabcock/cargo-deb | c8fbe560126afaef95770fc2e1338172bc8df45c | [
"MIT"
] | null | null | null | src/manifest.rs | nickbabcock/cargo-deb | c8fbe560126afaef95770fc2e1338172bc8df45c | [
"MIT"
] | null | null | null | use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::fs;
use std::collections::{HashMap, HashSet};
use std::borrow::Cow;
use listener::Listener;
use toml;
use file;
use glob;
use dependencies::resolve;
use serde_json;
use error::*;
use try::Try;
use config:... | 38.111554 | 161 | 0.563628 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn match_arm_arch() {\n assert_eq!(\"armhf\", get_arch(\"arm-unknown-linux-gnueabihf\"));\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn assets() {\n let a = Asset::new(\n AssetSource::Path(PathBuf::from(\"tar... |
f703035ad9d83c3df928dcdd6238f03faf9ad152 | 10,322 | rs | Rust | kf-protocol-api/src/error.rs | vijaylaxmid/flv-kf-protocol | 19d5811be008b941c32c1a293cdc41b13aa024f0 | [
"Apache-2.0"
] | null | null | null | kf-protocol-api/src/error.rs | vijaylaxmid/flv-kf-protocol | 19d5811be008b941c32c1a293cdc41b13aa024f0 | [
"Apache-2.0"
] | null | null | null | kf-protocol-api/src/error.rs | vijaylaxmid/flv-kf-protocol | 19d5811be008b941c32c1a293cdc41b13aa024f0 | [
"Apache-2.0"
] | null | null | null | use flv_util::string_helper::upper_cammel_case_to_sentence;
use serde::{Serialize, Deserialize};
use kf_protocol_derive::Decode;
use kf_protocol_derive::Encode;
/// kafka error
/// https://kafka.apache.org/protocol#protocol_types
#[repr(i16)]
#[derive(PartialEq, Debug, Clone, Copy, Serialize, Deserialize, Encode, De... | 32.664557 | 416 | 0.706452 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_error_code_from_conversion() {\n let val: i16 = 6;\n let erro_code: ErrorCode = val.try_into().expect(\"convert\");\n assert_eq!(erro_code, ErrorCode::NotLeaderForPartition);\n }\n}"
] |
f7033ea3e1d72a6ab831e5f7db1b3ddb9dbacf80 | 1,627 | rs | Rust | tests/gauge.rs | heyrict/tui-rs | 2233cdc9cce34342eef778912d87e0121a734f4e | [
"MIT"
] | 2 | 2020-02-24T10:33:22.000Z | 2021-11-03T03:25:31.000Z | tests/gauge.rs | heyrict/tui-rs | 2233cdc9cce34342eef778912d87e0121a734f4e | [
"MIT"
] | 1 | 2019-11-20T05:48:58.000Z | 2019-11-20T05:48:58.000Z | tests/gauge.rs | heyrict/tui-rs | 2233cdc9cce34342eef778912d87e0121a734f4e | [
"MIT"
] | 2 | 2020-11-17T13:08:48.000Z | 2021-04-18T12:32:43.000Z | use tui::backend::TestBackend;
use tui::buffer::Buffer;
use tui::layout::{Constraint, Direction, Layout};
use tui::widgets::{Block, Borders, Gauge, Widget};
use tui::Terminal;
#[test]
fn gauge_render() {
let backend = TestBackend::new(40, 10);
let mut terminal = Terminal::new(backend).unwrap();
terminal
... | 37.837209 | 95 | 0.385372 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn gauge_render() {\n let backend = TestBackend::new(40, 10);\n let mut terminal = Terminal::new(backend).unwrap();\n terminal\n .draw(|mut f| {\n let chunks = Layout::default()\n .direction(Direction::Vertical... |
f70349d0ee08bd80b80becca173598ecb950fc6d | 4,133 | rs | Rust | src/librustc/lib.rs | AaronFriel/rust | 33fcb7e7a41aa7d8b0f691ea92ebe10f20d9bd44 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/librustc/lib.rs | AaronFriel/rust | 33fcb7e7a41aa7d8b0f691ea92ebe10f20d9bd44 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/librustc/lib.rs | AaronFriel/rust | 33fcb7e7a41aa7d8b0f691ea92ebe10f20d9bd44 | [
"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... | 26.49359 | 88 | 0.702153 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn noop() {\n rustc_data_structures::__noop_fix_for_27438();\n}\n}"
] |
f703708991631cf0413bc639e0d8b54c950fcdfe | 59,635 | rs | Rust | tests/client.rs | davidhewitt/fix-rs | 25336797b5373893231ea56f43a4c0d8cb3615f5 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2020-10-07T12:41:55.000Z | 2021-03-28T03:06:41.000Z | tests/client.rs | davidhewitt/fix-rs | 25336797b5373893231ea56f43a4c0d8cb3615f5 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | tests/client.rs | davidhewitt/fix-rs | 25336797b5373893231ea56f43a4c0d8cb3615f5 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // Copyright 2016 James Bendig. See the COPYRIGHT file at the top-level
// directory of this distribution.
//
// Licensed under:
// the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>
// or the Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>... | 39.73018 | 147 | 0.67561 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_recv_resend_request_invalid_end_seq_no() {\n define_dictionary!(Logon, ResendRequest, Reject,);\n\n //Connect and Logon.\n let (mut test_server, _client, _) = TestStream::setup_test_server_and_logon(build_dictionary());\n\n //Send R... |
f703b5e959ca4ddfd38c560d802b75e29f041540 | 3,520 | rs | Rust | compiler/crates/schema/tests/build_schema_test.rs | erictaylor/relay | fa1c75d263b8257cfbea541e8bcfa1bc69e75367 | [
"MIT"
] | null | null | null | compiler/crates/schema/tests/build_schema_test.rs | erictaylor/relay | fa1c75d263b8257cfbea541e8bcfa1bc69e75367 | [
"MIT"
] | null | null | null | compiler/crates/schema/tests/build_schema_test.rs | erictaylor/relay | fa1c75d263b8257cfbea541e8bcfa1bc69e75367 | [
"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.
*
* @generated SignedSource<<d7c16c29bd10615430a1b09fe261a111>>
*/
mod build_schema;
use build_schema::transform_fixture;
use fixtu... | 50.285714 | 196 | 0.785795 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn directives_for_external_types() {\n let input = include_str!(\"build_schema/fixtures/directives-for-external-types.graphql\");\n let expected = include_str!(\"build_schema/fixtures/directives-for-external-types.expected\");\n test_fixture(t... |
f703ec840c718d32d516a93b9d896a40e16baf40 | 3,470 | rs | Rust | src/endpoints/dns/edit.rs | muchobien/porkbun-rs | a5773ffedf1a761da22907bb3c7ccb1cccb08bcb | [
"MIT"
] | 2 | 2021-06-04T15:00:03.000Z | 2021-07-17T10:51:05.000Z | src/endpoints/dns/edit.rs | muchobien/porkbun-rs | a5773ffedf1a761da22907bb3c7ccb1cccb08bcb | [
"MIT"
] | 1 | 2021-06-04T19:36:09.000Z | 2021-06-04T19:36:09.000Z | src/endpoints/dns/edit.rs | muchobien/porkbun-rs | a5773ffedf1a761da22907bb3c7ccb1cccb08bcb | [
"MIT"
] | null | null | null | use super::{fill_body_with_record, DnsContent};
use crate::api::Endpoint;
use derive_builder::Builder;
use http::Method;
use serde_json::{Map, Value};
use std::borrow::Cow;
#[derive(Debug, Builder)]
#[builder(setter(strip_option))]
pub struct EditDns<'a> {
#[builder(setter(into))]
record: DnsContent,
#[bui... | 25.144928 | 67 | 0.497406 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn record_is_necessary() {\n let err = EditDns::builder().build().unwrap_err();\n assert_eq!(\"`record` must be initialized\", err.to_string())\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn domain_is_nec... |
f703fe03c06d740e5e4f8540ea77fb01065cea1e | 4,721 | rs | Rust | src/modifiers.rs | spaceapi-community/spaceapi-server-rs | 6ac36d895866291f96c9f7d83a87768de4e46b67 | [
"Apache-2.0",
"MIT"
] | 1 | 2019-07-08T20:08:16.000Z | 2019-07-08T20:08:16.000Z | src/modifiers.rs | spaceapi-community/spaceapi-server-rs | 6ac36d895866291f96c9f7d83a87768de4e46b67 | [
"Apache-2.0",
"MIT"
] | 29 | 2018-01-21T23:37:59.000Z | 2021-08-29T14:52:29.000Z | src/modifiers.rs | spaceapi-community/spaceapi-server-rs | 6ac36d895866291f96c9f7d83a87768de4e46b67 | [
"Apache-2.0",
"MIT"
] | 4 | 2018-10-11T09:38:56.000Z | 2019-11-15T14:49:03.000Z | //! Modifiers which can be injected by the application logic to change the
//! state dynamically per request.
use crate::api;
/// `StatusModifier`s are used to modify the status
pub trait StatusModifier: Send + Sync {
/// Called after all registered sensors are read
fn modify(&self, status: &mut api::Status);... | 33.964029 | 101 | 0.512603 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn no_sensors() {\n let mut status = api::Status {\n sensors: None,\n ..api::Status::default()\n };\n assert_eq!(status.state, None);\n StateFromPeopleNowPresent.modify(&mut stat... |
f703fe3c7ad8b0a87c38e289b2eef085f76ea509 | 13,942 | rs | Rust | src/mmap_unix.rs | gc-plp/vm-memory | a481693670c2954b81e65b8762fa40f61404976c | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/mmap_unix.rs | gc-plp/vm-memory | a481693670c2954b81e65b8762fa40f61404976c | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/mmap_unix.rs | gc-plp/vm-memory | a481693670c2954b81e65b8762fa40f61404976c | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | // Copyright (C) 2019 Alibaba Cloud Computing. All rights reserved.
//
// Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Portions Copyright 2017 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... | 34.171569 | 99 | 0.581265 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_mmap_region_new() {\n assert!(MmapRegion::new(0).is_err());\n\n let size = 4096;\n\n let r = MmapRegion::new(4096).unwrap();\n assert_eq!(r.size(), size);\n assert!(r.file_offset().is_none());\n assert_... |
f703ff99660c6ae4691119ad4d830d8b530f0300 | 44,774 | rs | Rust | src/libcollections/string.rs | kmcguire3413/rust | 27bdf5ccbfe6f613b00e4c3b023140576f394172 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libcollections/string.rs | kmcguire3413/rust | 27bdf5ccbfe6f613b00e4c3b023140576f394172 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libcollections/string.rs | kmcguire3413/rust | 27bdf5ccbfe6f613b00e4c3b023140576f394172 | [
"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 ... | 29.475971 | 99 | 0.51617 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_as_string() {\n let x = \"foo\";\n assert_eq!(x, as_string(x).as_slice());\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_from_str() {\n let owned: Option<::std::string::String> = from_s... |
f70405ca51d91637498909e1a34332c669071d30 | 773 | rs | Rust | tests/spec/non_conformant/basic/t59_if_expression.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 329 | 2017-02-18T12:39:56.000Z | 2022-03-31T06:52:18.000Z | tests/spec/non_conformant/basic/t59_if_expression.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 73 | 2017-04-28T19:26:26.000Z | 2022-03-05T15:51:09.000Z | tests/spec/non_conformant/basic/t59_if_expression.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 27 | 2017-06-05T23:02:14.000Z | 2022-03-28T00:42:52.000Z | //! Tests auto-converted from "sass-spec/spec/non_conformant/basic/59_if_expression.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner()
}
#[test]
fn test() {
assert_eq!(
runner().ok(
"$x: 0;\
\n$if-false: whatever;\n\
\ndiv {\
\n ... | 26.655172 | 88 | 0.446313 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test() {\n assert_eq!(\n runner().ok(\n \"$x: 0;\\\n \\n$if-false: whatever;\\n\\\n \\ndiv {\\\n \\n foo: if($if-true: hey, $if-false: ho, $condition: true);\\\n \\n foo: if($if-... |
f7040a46bf0373e5f9ccb8a5dfb7dc41f73282f8 | 8,791 | rs | Rust | src/lib.rs | umaYnit/shadow-rs | 5f964033fcf5ae9d4e12004ed93ed283fc295ddb | [
"MIT"
] | null | null | null | src/lib.rs | umaYnit/shadow-rs | 5f964033fcf5ae9d4e12004ed93ed283fc295ddb | [
"MIT"
] | null | null | null | src/lib.rs | umaYnit/shadow-rs | 5f964033fcf5ae9d4e12004ed93ed283fc295ddb | [
"MIT"
] | null | null | null | //! `shadow-rs` is a build script write by Rust
//!
//! It's can record compiled project much information.
//! Like version info,dependence info.Like shadow,if compiled,never change.forever follow your project.
//!
//! Generated rust const by exec:`cargo build`
//!
//! # Example
//!
//! ```
//! pub const RUST_VERSION :... | 28.542208 | 135 | 0.56046 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_build() -> SdResult<()> {\n Shadow::build(\"./\".into(), \"./\".into())?;\n Ok(())\n }\n}"
] |
f7041372a09ccffa8748a7f0650cc49ba05c26f2 | 544 | rs | Rust | native_implemented/otp/src/erlang/send_2/test/with_atom_destination.rs | mlwilkerson/lumen | 048df6c0840c11496e2d15aa9af2e4a8d07a6e0f | [
"Apache-2.0"
] | 2,939 | 2019-08-29T16:52:20.000Z | 2022-03-31T05:42:30.000Z | native_implemented/otp/src/erlang/send_2/test/with_atom_destination.rs | mlwilkerson/lumen | 048df6c0840c11496e2d15aa9af2e4a8d07a6e0f | [
"Apache-2.0"
] | 235 | 2019-08-29T23:44:13.000Z | 2022-03-17T11:43:25.000Z | native_implemented/otp/src/erlang/send_2/test/with_atom_destination.rs | mlwilkerson/lumen | 048df6c0840c11496e2d15aa9af2e4a8d07a6e0f | [
"Apache-2.0"
] | 95 | 2019-08-29T19:11:28.000Z | 2022-01-03T05:14:16.000Z | use super::*;
mod registered;
#[test]
fn unregistered_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::atom(),
strategy::term(arc_process.clone()),
)
},
|(arc_process, destination, m... | 21.76 | 64 | 0.457721 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn unregistered_errors_badarg() {\n run!(\n |arc_process| {\n (\n Just(arc_process.clone()),\n strategy::term::atom(),\n strategy::term(arc_process.clone()),\n )\n },\n... |
f7044d3ec93d760dcc3d6063096c373aaab80813 | 29,755 | rs | Rust | zeropool-substrate-devnet/pallets/zeropool-substrate/src/lib.rs | w3f-community/zeropool-substrate | 474a680cb8bf3f2d18e09a5682fff14d57367594 | [
"Apache-2.0",
"MIT"
] | null | null | null | zeropool-substrate-devnet/pallets/zeropool-substrate/src/lib.rs | w3f-community/zeropool-substrate | 474a680cb8bf3f2d18e09a5682fff14d57367594 | [
"Apache-2.0",
"MIT"
] | null | null | null | zeropool-substrate-devnet/pallets/zeropool-substrate/src/lib.rs | w3f-community/zeropool-substrate | 474a680cb8bf3f2d18e09a5682fff14d57367594 | [
"Apache-2.0",
"MIT"
] | null | null | null | // Zeropool Substrate Pallet
// example to submit to test_groth16verify: {"proof":"Qexag8d0jvm1IWZywscRBuvdSEvlGuhvVg5Qj97vhS5VFas06bgj/yXiuZ+yJ/WZWCYDYq8e5HZPITpoaHAvGckDPBplyUtn8zZ3UI4f5E1uLmxlehAkzVK33Fp8/SEZX4v8OLLT3MP/FWhDvS43u2sLvZcCstjVjbarImuLiSA0IW7UmNgG7u8x99JExO0pp0EAGJ3PiBOzyZ/PhxUPBXvOgxhwNzx0nzZzp+aSY8yhs... | 72.750611 | 1,506 | 0.765922 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn deserialize_json() {\n let jvkproofinput: Vec<u8>=br#\"{\"vk\":\"yO5EICtE+JVjTbRYkayI0Y/BoOJtE9lsrqeCTKTDnxD8UjB8B51wrVsQsVrsi6Uk0b2UKGfs3AJUX2Eud5wnET/ze/CsefR74bOn50BmVoExPPDiJGRD2IejItInd/wbtAH7GstyB1Q1j9uROBBAgE2eEj/cwRcHJobe4MP1mQIsiHdC5... |
f704c532907ed09f7d268415b0c6fbb2abf5a86e | 3,521 | rs | Rust | src/identity.rs | transumption-unstable/zerotier | 891b17b292abb2d7f982675c4c778613edfda59f | [
"Apache-2.0"
] | 2 | 2020-11-22T20:50:54.000Z | 2021-02-06T13:02:47.000Z | src/identity.rs | transumption-unstable/zerotier | 891b17b292abb2d7f982675c4c778613edfda59f | [
"Apache-2.0"
] | 2 | 2020-01-29T13:24:14.000Z | 2020-04-22T03:39:13.000Z | src/identity.rs | transumption/zerotier-rust | 891b17b292abb2d7f982675c4c778613edfda59f | [
"Apache-2.0"
] | 1 | 2021-07-10T18:34:30.000Z | 2021-07-10T18:34:30.000Z | use crate::{Address, InternalError, PublicKey, SecretKey};
use ed25519_dalek::Keypair;
use failure::*;
use std::convert::{TryFrom, TryInto};
use std::fs;
use std::path::Path;
/// Combination of [`Address`](struct.Address.html), [`PublicKey`](struct.PublicKey) and optionally
/// [`SecretKey`](struct.SecretKey.html).
... | 32.302752 | 300 | 0.641579 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_identity() -> Fallible<()> {\n // nix-shell -p zerotierone --run 'zerotier-idtool generate'\n let identity_str = \"538c34e03c:0:070288330a72d2aa3cb7935dfe6028d9fb83bdb42240aaa05e33529121babd183ff775351742a47487454195c08c0e83c520e7... |
f704c6355e42d1c4fe88e674b07b0a95a07be04b | 2,118 | rs | Rust | kata/roman_numerals/src/tests.rs | erickhagstrom/rust_stuff | 94712813ec44ceb17e75f6d407cfb111499bbc76 | [
"Unlicense"
] | null | null | null | kata/roman_numerals/src/tests.rs | erickhagstrom/rust_stuff | 94712813ec44ceb17e75f6d407cfb111499bbc76 | [
"Unlicense"
] | null | null | null | kata/roman_numerals/src/tests.rs | erickhagstrom/rust_stuff | 94712813ec44ceb17e75f6d407cfb111499bbc76 | [
"Unlicense"
] | null | null | null | use crate::*;
fn test_roman(given: usize, expected: &str) {
assert_eq!(arabic_to_roman(given).unwrap(), expected);
}
#[test]
fn one() {
test_roman(1, "I");
}
#[test]
fn two() {
test_roman(2, "II");
}
#[test]
fn three() {
test_roman(3, "III");
}
#[test]
fn four() {
test_roman(4, "IV");
}
#[test]
fn five(... | 12.313953 | 56 | 0.596317 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn one() {\n test_roman(1, \"I\");\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn two() {\n test_roman(2, \"II\");\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn three() {\n test_roman(3, \... |
f704da39d6b1a2c5c9da1a7e173a168d567ab611 | 2,168 | rs | Rust | src/problem/p0190_reverse_bits.rs | RUAN0007/leetcode-rust | 9d8a05c7e8b5bb9112ea4e46a6ff64cc6902d728 | [
"Apache-2.0"
] | 1 | 2022-03-11T07:56:11.000Z | 2022-03-11T07:56:11.000Z | src/problem/p0190_reverse_bits.rs | RUAN0007/leetcode-rust | 9d8a05c7e8b5bb9112ea4e46a6ff64cc6902d728 | [
"Apache-2.0"
] | null | null | null | src/problem/p0190_reverse_bits.rs | RUAN0007/leetcode-rust | 9d8a05c7e8b5bb9112ea4e46a6ff64cc6902d728 | [
"Apache-2.0"
] | null | null | null | /**
* [190] Reverse Bits
*
* Reverse bits of a given 32 bits unsigned integer.
* Note:
*
* Note that in some languages such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's interna... | 35.540984 | 298 | 0.706181 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_190() {\n assert_eq!(Solution::reverse_bits(43261596), 964176192);\n }\n}"
] |
f70504b021fda64d350f0d132fae4030a3629603 | 4,479 | rs | Rust | src/fixes/leading_character.rs | PurpleMyst/dotenv-linter | 371c3c3d33b3bffaab8bd7abec326ae8239c700b | [
"MIT"
] | null | null | null | src/fixes/leading_character.rs | PurpleMyst/dotenv-linter | 371c3c3d33b3bffaab8bd7abec326ae8239c700b | [
"MIT"
] | 8 | 2020-04-24T20:37:04.000Z | 2020-07-08T19:53:31.000Z | src/fixes/leading_character.rs | PurpleMyst/dotenv-linter | 371c3c3d33b3bffaab8bd7abec326ae8239c700b | [
"MIT"
] | null | null | null | use super::Fix;
use crate::common::*;
pub(crate) struct LeadingCharacterFixer<'a> {
name: &'a str,
}
impl Default for LeadingCharacterFixer<'_> {
fn default() -> Self {
Self {
name: "LeadingCharacter",
}
}
}
impl Fix for LeadingCharacterFixer<'_> {
fn name(&self) -> &str {... | 29.86 | 75 | 0.56017 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fix_leading_dot() {\n let mut fixer = LeadingCharacterFixer::default();\n let mut leading_period = line_entry(1, 1, \".FOO=BAR\");\n\n assert_eq!(Some(()), fixer.fix_line(&mut leading_period));\n assert_eq!(\"FOO=BAR\", l... |
f7050bff5df18b67f31b6c8d06a77934e753f4a8 | 6,369 | rs | Rust | src/dispatching/update_listeners/polling.rs | berkus/teloxide | c7c9ce93e97f4ca6f565d5c4e248677a07215263 | [
"MIT"
] | 1,117 | 2019-12-10T13:53:31.000Z | 2022-03-30T04:22:46.000Z | src/dispatching/update_listeners/polling.rs | berkus/teloxide | c7c9ce93e97f4ca6f565d5c4e248677a07215263 | [
"MIT"
] | 264 | 2019-11-30T19:43:16.000Z | 2022-03-27T09:30:19.000Z | src/dispatching/update_listeners/polling.rs | berkus/teloxide | c7c9ce93e97f4ca6f565d5c4e248677a07215263 | [
"MIT"
] | 122 | 2019-12-18T10:34:30.000Z | 2022-03-04T13:59:52.000Z | use std::{convert::TryInto, time::Duration};
use futures::{
future::{ready, Either},
stream::{self, Stream, StreamExt},
};
use crate::{
dispatching::{
stop_token::{AsyncStopFlag, AsyncStopToken},
update_listeners::{stateful_listener::StatefulListener, UpdateListener},
},
payloads::... | 32.829897 | 99 | 0.534621 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn polling_is_send() {\n use crate::dispatching::update_listeners::AsUpdateStream;\n\n let bot = crate::Bot::new(\"TOKEN\");\n let mut polling = polling(bot, None, None, None);\n\n assert_send(&polling);\n assert_send(&polling.as_stream(... |
f7054d0c6b3cda6589cdd350c08e2815fe871087 | 3,800 | rs | Rust | tests/clones.rs | azriel91/rayon | 067a294cbd967940723a49ea5c9b1312a5b1b5ac | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/clones.rs | azriel91/rayon | 067a294cbd967940723a49ea5c9b1312a5b1b5ac | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/clones.rs | azriel91/rayon | 067a294cbd967940723a49ea5c9b1312a5b1b5ac | [
"Apache-2.0",
"MIT"
] | null | null | null | extern crate rayon;
use rayon::prelude::*;
fn check<I>(iter: I)
where I: ParallelIterator + Clone,
I::Item: std::fmt::Debug + PartialEq
{
let a: Vec<_> = iter.clone().collect();
let b: Vec<_> = iter.collect();
assert_eq!(a, b);
}
#[test]
fn clone_binary_heap() {
use std::collections::Bi... | 23.899371 | 68 | 0.6 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn clone_binary_heap() {\n use std::collections::BinaryHeap;\n let heap: BinaryHeap<_> = (0..1000).collect();\n check(heap.par_iter());\n check(heap.into_par_iter());\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n ... |
f70565cd4da6e94b5486c1c7becc13dc3a605169 | 9,667 | rs | Rust | proto/src/text.rs | first-rust-competition/nt4-mvp | 10c850a46419e575927b32866fd2bf505dc52211 | [
"Apache-2.0"
] | null | null | null | proto/src/text.rs | first-rust-competition/nt4-mvp | 10c850a46419e575927b32866fd2bf505dc52211 | [
"Apache-2.0"
] | null | null | null | proto/src/text.rs | first-rust-competition/nt4-mvp | 10c850a46419e575927b32866fd2bf505dc52211 | [
"Apache-2.0"
] | null | null | null | use crate::bin::NTValue;
use crate::text::directory::*;
use crate::text::publish::*;
use crate::text::subscription::*;
use serde::{Deserialize, Serialize};
use serde_json::Value;
macro_rules! impl_message {
($($name:ident),+) => {
$(
impl MessageBody for $name {
fn into_message(self) ->... | 36.342105 | 212 | 0.623668 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_de() {\n let msg = r#\"{\"type\":\"publish\", \"data\": {\"name\": \"/foo\", \"type\": \"integer\"}}\"#;\n let msg = serde_json::from_str::<NTTextMessage>(msg).unwrap();\n assert_eq!(msg._type, MessageType::PublishReq);\n ... |
f70569895328584dbaf556e70c4971555600f5a1 | 9,483 | rs | Rust | fj-app/src/kernel/algorithms/approximation.rs | mxdamien/Fornjot | 750a668e72d1630b1ac0d71f8872f260fde5155f | [
"0BSD"
] | null | null | null | fj-app/src/kernel/algorithms/approximation.rs | mxdamien/Fornjot | 750a668e72d1630b1ac0d71f8872f260fde5155f | [
"0BSD"
] | 17 | 2022-01-31T11:26:08.000Z | 2022-03-14T18:59:25.000Z | fj-app/src/kernel/algorithms/approximation.rs | mxdamien/Fornjot | 750a668e72d1630b1ac0d71f8872f260fde5155f | [
"0BSD"
] | null | null | null | use std::collections::HashSet;
use crate::{
kernel::topology::{
edges::{Cycle, Edge},
faces::Face,
vertices::Vertex,
},
math::{Point, Scalar, Segment},
};
/// An approximation of an edge, multiple edges, or a face
#[derive(Debug, PartialEq)]
pub struct Approximation {
/// All p... | 32.145763 | 80 | 0.541495 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn for_edge() {\n // Doesn't test `Approximation::for_edge` directly, but that method only\n // contains a bit of additional glue code that is not critical.\n\n let mut shape = Shape::new();\n\n let a = Point::from([1., 2., ... |
f7056abbd92d63c59d4548b020a54f5da1b55e2e | 51,792 | rs | Rust | write_buffer/src/table.rs | CJP10/influxdb_iox | cdb26e60e4531dddbe0e40c6e571ff1b6de20909 | [
"Apache-2.0",
"MIT"
] | null | null | null | write_buffer/src/table.rs | CJP10/influxdb_iox | cdb26e60e4531dddbe0e40c6e571ff1b6de20909 | [
"Apache-2.0",
"MIT"
] | null | null | null | write_buffer/src/table.rs | CJP10/influxdb_iox | cdb26e60e4531dddbe0e40c6e571ff1b6de20909 | [
"Apache-2.0",
"MIT"
] | null | null | null | use generated_types::wal as wb;
use query::exec::{make_schema_pivot, GroupedSeriesSetPlan, SeriesSetPlan};
use tracing::debug;
use std::{collections::BTreeSet, collections::HashMap, sync::Arc};
use crate::{
column,
column::Column,
dictionary::{Dictionary, Error as DictionaryError},
partition::Partitio... | 34.947368 | 111 | 0.546957 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_has_columns() {\n // setup a test table\n let mut partition = Partition::new(\"dummy_partition_key\");\n let dictionary = &mut partition.dictionary;\n let mut table = Table::new(dictionary.lookup_value_or_insert(\"ta... |
f705aecba5408db48580803d5f08c6fd72e20f31 | 9,884 | rs | Rust | src/webhook_handler.rs | FlareFlo/WT_event_handler | 6eb30b5db324f3722d85180b72f5e2efb082d31d | [
"MIT"
] | 1 | 2021-07-26T16:17:11.000Z | 2021-07-26T16:17:11.000Z | src/webhook_handler.rs | FlareFlo/WT_event_handler | 6eb30b5db324f3722d85180b72f5e2efb082d31d | [
"MIT"
] | 6 | 2021-08-30T18:17:35.000Z | 2021-11-08T15:29:51.000Z | src/webhook_handler.rs | FlareFlo/WT_event_handler | 6eb30b5db324f3722d85180b72f5e2efb082d31d | [
"MIT"
] | 1 | 2021-08-04T09:01:47.000Z | 2021-08-04T09:01:47.000Z | use std::fs;
use log::{error, warn};
use serenity::http::Http;
use crate::json::recent::Channel;
use crate::json::webhooks::{FilterType, Hooks, WebhookAuth};
use crate::scrapers::scraper_resources::resources::ScrapeType;
use crate::TOKEN_PATH;
const DEFAULT_KEYWORDS: [&str; 28] = [
"devblog", "event", "maintenance"... | 29.504478 | 114 | 0.632234 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn main_test_filter_default_pass() {\n\t\tassert_eq!(match_filter(\"pass\", &Hooks {\n\t\t\tname: \"\".to_string(),\n\t\t\ttoken: \"\".to_string(),\n\t\t\tuid: 0,\n\t\t\tmain_filter: FilterType::default(),\n\t\t\tforum_filter: FilterType::default(),\n\... |
f705bd8260fe0e89c1947437a85c92063456b856 | 2,658 | rs | Rust | crates/nu-command/tests/format_conversions/html.rs | PurityLake/nushell | 1cb449b2d14bcd77305024716db13a7dbecaede7 | [
"MIT"
] | null | null | null | crates/nu-command/tests/format_conversions/html.rs | PurityLake/nushell | 1cb449b2d14bcd77305024716db13a7dbecaede7 | [
"MIT"
] | null | null | null | crates/nu-command/tests/format_conversions/html.rs | PurityLake/nushell | 1cb449b2d14bcd77305024716db13a7dbecaede7 | [
"MIT"
] | null | null | null | use nu_test_support::{nu, pipeline};
#[test]
fn out_html_simple() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 3 | to html
"#
));
assert_eq!(
actual.out,
r"<html><style>body { background-color:white;color:black; }</style><body>3</body></html>"
);... | 34.519481 | 809 | 0.558315 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn out_html_simple() {\n let actual = nu!(\n cwd: \".\", pipeline(\n r#\"\n echo 3 | to html\n \"#\n ));\n\n assert_eq!(\n actual.out,\n r\"<html><style>body { background-color:white;color:black; }... |
f70604c3bbbfb32bb33120cecdbf9d4c66b7dde1 | 16,887 | rs | Rust | src/ensemble/random_forest_classifier.rs | MaxGreil/smartcore | 521dab49ef92a955eb860ca195c89feab17c4b59 | [
"Apache-2.0"
] | null | null | null | src/ensemble/random_forest_classifier.rs | MaxGreil/smartcore | 521dab49ef92a955eb860ca195c89feab17c4b59 | [
"Apache-2.0"
] | null | null | null | src/ensemble/random_forest_classifier.rs | MaxGreil/smartcore | 521dab49ef92a955eb860ca195c89feab17c4b59 | [
"Apache-2.0"
] | null | null | null | //! # Random Forest Classifier
//! A random forest is an ensemble estimator that fits multiple [decision trees](../../tree/index.html) to random subsets of the dataset and averages predictions
//! to improve the predictive accuracy and control over-fitting. See [ensemble models](../index.html) for more details.
//!
//!... | 35.777542 | 161 | 0.514183 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fit_predict_iris() {\n let x = DenseMatrix::from_2d_array(&[\n &[5.1, 3.5, 1.4, 0.2],\n &[4.9, 3.0, 1.4, 0.2],\n &[4.7, 3.2, 1.3, 0.2],\n &[4.6, 3.1, 1.5, 0.2],\n &[5.0, 3.6, 1.4, 0.2],\n... |
f70650b15535f1eac8ae45c607d625b0fa56e3af | 21,342 | rs | Rust | src/crypto.rs | gakz/hedera-ios-sdk | 5e37ff27bda18c64bc74af4c34eee617b8104075 | [
"Apache-2.0"
] | 8 | 2019-06-08T17:45:26.000Z | 2019-09-24T22:15:30.000Z | src/crypto.rs | gakz/hedera-ios-sdk | 5e37ff27bda18c64bc74af4c34eee617b8104075 | [
"Apache-2.0"
] | 1 | 2019-06-11T14:43:13.000Z | 2019-06-12T15:27:28.000Z | src/crypto.rs | gakz/hedera-ios-sdk | 5e37ff27bda18c64bc74af4c34eee617b8104075 | [
"Apache-2.0"
] | 3 | 2019-07-09T19:10:06.000Z | 2020-02-13T03:10:13.000Z | use crate::proto::{self, ToProto};
use bip39::{Language, Mnemonic, MnemonicType, Seed};
use ed25519_dalek;
use failure::{bail, err_msg, Error};
use failure_derive::Fail;
use hex;
use num::BigUint;
use once_cell::{sync::Lazy, sync_lazy};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
use simple_asn1::{
der_decod... | 31.293255 | 159 | 0.573798 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_parse() -> Result<(), Error> {\n let public_key1: PublicKey = KEY_PUBLIC_ASN1_HEX.parse()?;\n let public_key2: PublicKey = KEY_PUBLIC_HEX.parse()?;\n\n let secret_key1: SecretKey = KEY_SECRET_ASN1_HEX.parse()?;\n let... |
f70659792bb457799c663f913290d78f08e00fa9 | 35,483 | rs | Rust | src/lib.rs | Pierre-Colin/rcvs | ae8710d7e0b4e93aaa3504e9e5fea3f379677dcc | [
"MIT"
] | null | null | null | src/lib.rs | Pierre-Colin/rcvs | ae8710d7e0b4e93aaa3504e9e5fea3f379677dcc | [
"MIT"
] | 1 | 2019-04-07T05:25:24.000Z | 2019-04-07T05:25:24.000Z | src/lib.rs | Pierre-Colin/rcvs | ae8710d7e0b4e93aaa3504e9e5fea3f379677dcc | [
"MIT"
] | null | null | null | //! # Randomized Condorcet Voting System
//!
//! The crate `rcvs` implements the Randomized Condorcet Voting System, a
//! strategy-proof voting system using game theory to generalize the original
//! Condorcet method.
//!
//! ## Condorcet method
//!
//! The Condorcet method consists of building a directed graph called... | 36.769948 | 103 | 0.498351 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn source_strategy() {\n let names = string_vec![\"Alpha\", \"Bravo\", \"Charlie\", \"Delta\", \"Echo\", \"Foxtrot\"];\n for n in 1..=names.len() {\n for _ in 0..100 {\n let mut m = Adjacency::from_element(n, n, ... |
f706661713e9db3e8f637bb680f03b51963600e0 | 21,818 | rs | Rust | src/proc/bin/starnix/fs/namespace.rs | sffc/fuchsia-clone | 633553d647314c9032f75d430c9377b9f6cfc26e | [
"BSD-2-Clause"
] | null | null | null | src/proc/bin/starnix/fs/namespace.rs | sffc/fuchsia-clone | 633553d647314c9032f75d430c9377b9f6cfc26e | [
"BSD-2-Clause"
] | 1 | 2022-03-01T01:12:04.000Z | 2022-03-01T01:17:26.000Z | src/proc/bin/starnix/fs/namespace.rs | sffc/fuchsia-clone | 633553d647314c9032f75d430c9377b9f6cfc26e | [
"BSD-2-Clause"
] | null | null | null | // Copyright 2021 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.
use std::collections::HashMap;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::sync::{Arc, Weak};
use once_cell::sync::OnceCell;
use parking_lot::Rw... | 36.302829 | 98 | 0.578926 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_namespace() -> anyhow::Result<()> {\n let (_kernel, current_task) = create_kernel_and_task();\n let root_fs = TmpFs::new();\n let root_node = Arc::clone(root_fs.root());\n let _dev_node = root_node.create_dir(b\"dev\... |
f70679297aaf2fb0b8b08b1c0a1c3250f859750d | 355 | rs | Rust | tests/spec/non_conformant/misc/lang_bug.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 329 | 2017-02-18T12:39:56.000Z | 2022-03-31T06:52:18.000Z | tests/spec/non_conformant/misc/lang_bug.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 73 | 2017-04-28T19:26:26.000Z | 2022-03-05T15:51:09.000Z | tests/spec/non_conformant/misc/lang_bug.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 27 | 2017-06-05T23:02:14.000Z | 2022-03-28T00:42:52.000Z | //! Tests auto-converted from "sass-spec/spec/non_conformant/misc/lang-bug.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner()
}
#[test]
fn test() {
assert_eq!(
runner().ok("div:lang(nb) {\
\n color: red;\
\n}"),
"div:lang(nb) {\
\n col... | 18.684211 | 79 | 0.487324 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test() {\n assert_eq!(\n runner().ok(\"div:lang(nb) {\\\n \\n color: red;\\\n \\n}\"),\n \"div:lang(nb) {\\\n \\n color: red;\\\n \\n}\\n\"\n );\n}\n}"
] |
f706a8d9c10c6727554de6d5839aea4e5f9881ce | 9,089 | rs | Rust | crossbeam-deque/tests/injector.rs | imotai/crossbeam | 78b7ac386fb21edc21f54ff48be47e2d7fedcee8 | [
"Apache-2.0",
"MIT"
] | null | null | null | crossbeam-deque/tests/injector.rs | imotai/crossbeam | 78b7ac386fb21edc21f54ff48be47e2d7fedcee8 | [
"Apache-2.0",
"MIT"
] | null | null | null | crossbeam-deque/tests/injector.rs | imotai/crossbeam | 78b7ac386fb21edc21f54ff48be47e2d7fedcee8 | [
"Apache-2.0",
"MIT"
] | null | null | null | use std::sync::atomic::Ordering::SeqCst;
use std::sync::atomic::{AtomicBool, AtomicUsize};
use std::sync::{Arc, Mutex};
use crossbeam_deque::Steal::{Empty, Success};
use crossbeam_deque::{Injector, Worker};
use crossbeam_utils::thread::scope;
use rand::Rng;
#[test]
fn smoke() {
let q = Injector::new();
assert... | 24.172872 | 75 | 0.413137 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn smoke() {\n let q = Injector::new();\n assert_eq!(q.steal(), Empty);\n\n q.push(1);\n q.push(2);\n assert_eq!(q.steal(), Success(1));\n assert_eq!(q.steal(), Success(2));\n assert_eq!(q.steal(), Empty);\n\n q.push(3);\n as... |
f706b3f3edd6ea69abf947f825933a3e2cc527d0 | 13,592 | rs | Rust | examples/custom_router/router_macro_derive/src/lib.rs | arn-the-long-beard/old_seed_archive | 9aed8e64ab6ee5a2a6e9fd650eefb752fcb9144c | [
"MIT"
] | null | null | null | examples/custom_router/router_macro_derive/src/lib.rs | arn-the-long-beard/old_seed_archive | 9aed8e64ab6ee5a2a6e9fd650eefb752fcb9144c | [
"MIT"
] | null | null | null | examples/custom_router/router_macro_derive/src/lib.rs | arn-the-long-beard/old_seed_archive | 9aed8e64ab6ee5a2a6e9fd650eefb752fcb9144c | [
"MIT"
] | null | null | null | #[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
extern crate convert_case;
extern crate proc_macro;
extern crate proc_macro_error;
use crate::root::get_default_route;
use crate::routing::routing_variant_snippets;
use proc_macro::TokenStream;
use crate::routing_modules::... | 33.477833 | 124 | 0.546424 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn it_works() {\n assert_eq!(2 + 2, 4);\n }\n}"
] |
f706e377eb1e76a14386a192293e8caf5261b0d8 | 978 | rs | Rust | tests/ui-tests.rs | PoiScript/sqlx | fb66cfa66563e45a0f0dad3c8fd7dba8a264d346 | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/ui-tests.rs | PoiScript/sqlx | fb66cfa66563e45a0f0dad3c8fd7dba8a264d346 | [
"Apache-2.0",
"MIT"
] | null | null | null | tests/ui-tests.rs | PoiScript/sqlx | fb66cfa66563e45a0f0dad3c8fd7dba8a264d346 | [
"Apache-2.0",
"MIT"
] | null | null | null | #[test]
fn ui_tests() {
let t = trybuild::TestCases::new();
if cfg!(feature = "postgres") {
t.compile_fail("tests/ui/postgres/*.rs");
// UI tests for column types that require gated features
if cfg!(not(feature = "chrono")) {
t.compile_fail("tests/ui/postgres/gated/chrono.r... | 26.432432 | 67 | 0.54908 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn ui_tests() {\n let t = trybuild::TestCases::new();\n\n if cfg!(feature = \"postgres\") {\n t.compile_fail(\"tests/ui/postgres/*.rs\");\n\n // UI tests for column types that require gated features\n if cfg!(not(feature = \"... |
f70714032223829b5c7e33962e2a9d51f681ce10 | 3,998 | rs | Rust | src/sg_client.rs | peitalin/sendgrid-rs | 8324245b0b8258d4ec8772448ad1ebb37de362bc | [
"MIT"
] | null | null | null | src/sg_client.rs | peitalin/sendgrid-rs | 8324245b0b8258d4ec8772448ad1ebb37de362bc | [
"MIT"
] | null | null | null | src/sg_client.rs | peitalin/sendgrid-rs | 8324245b0b8258d4ec8772448ad1ebb37de362bc | [
"MIT"
] | null | null | null | use std::io::Read;
use reqwest::header::{self, HeaderMap, HeaderValue};
use reqwest::Client;
use url::form_urlencoded::Serializer;
use errors::SendgridResult;
use mail::Mail;
static API_URL: &'static str = "https://api.sendgrid.com/api/mail.send.json?";
/// This is the struct that allows you to authenticate to the ... | 31.234375 | 110 | 0.631316 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn basic_message_body() {\n use mail::Destination;\n\n let m = Mail::new()\n .add_to(Destination {\n address: \"test@example.com\",\n name: \"Testy mcTestFace\",\n })\n .add_from(\"me@example.com\")\n ... |
f70715ed756dca92167299284bec4ed71a4b8605 | 21,532 | rs | Rust | src/libstd/ptr.rs | BurntSushi/rust | 30fe55066a29a14fffd2a5f41e0ab21e7056fb34 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libstd/ptr.rs | BurntSushi/rust | 30fe55066a29a14fffd2a5f41e0ab21e7056fb34 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/libstd/ptr.rs | BurntSushi/rust | 30fe55066a29a14fffd2a5f41e0ab21e7056fb34 | [
"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.85511 | 100 | 0.51528 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test() {\n unsafe {\n struct Pair {\n fst: int,\n snd: int\n };\n let mut p = Pair {fst: 10, snd: 20};\n let pptr: *mut Pair = &mut p;\n let iptr: *mut int =... |
f707710cf25cbc9e8b44a56ce68a941334d997f8 | 9,511 | rs | Rust | object_store/src/path/parsed.rs | jacobmarble/influxdb_iox | 9868e18d0accc8d08eaa2ca87b6380ac45cf9078 | [
"Apache-2.0",
"MIT"
] | null | null | null | object_store/src/path/parsed.rs | jacobmarble/influxdb_iox | 9868e18d0accc8d08eaa2ca87b6380ac45cf9078 | [
"Apache-2.0",
"MIT"
] | null | null | null | object_store/src/path/parsed.rs | jacobmarble/influxdb_iox | 9868e18d0accc8d08eaa2ca87b6380ac45cf9078 | [
"Apache-2.0",
"MIT"
] | null | null | null | use super::{ObjectStorePath, PathPart, DELIMITER};
use itertools::Itertools;
/// A path stored as a collection of 0 or more directories and 0 or 1 file name
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
pub struct DirsAndFileName {
pub(crate) directories: Vec<PathPart>,
pub(crate) file_name... | 32.131757 | 95 | 0.533908 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn parts_after_prefix_behavior() {\n let mut existing_path = DirsAndFileName::default();\n existing_path.push_all_dirs(&[\"apple\", \"bear\", \"cow\", \"dog\"]);\n existing_path.file_name = Some(\"egg.json\".into());\n\n // ... |
f707aca217eee1788f83340bec2c4116ec13d89b | 2,799 | rs | Rust | tasks/zumkeller-numbers/src/main.rs | kaiuri/rust-rosetta | 67862e06956f955cdf34743a7e5c7c93e4077b64 | [
"Unlicense"
] | 412 | 2015-01-02T10:29:34.000Z | 2019-09-05T06:56:04.000Z | tasks/zumkeller-numbers/src/main.rs | kaiuri/rust-rosetta | 67862e06956f955cdf34743a7e5c7c93e4077b64 | [
"Unlicense"
] | 290 | 2015-01-02T20:32:42.000Z | 2019-09-05T14:17:06.000Z | tasks/zumkeller-numbers/src/main.rs | kaiuri/rust-rosetta | 67862e06956f955cdf34743a7e5c7c93e4077b64 | [
"Unlicense"
] | 142 | 2015-01-10T21:16:16.000Z | 2019-09-05T06:56:07.000Z | use std::convert::TryInto;
/// Gets all divisors of a number, including itself
fn get_divisors(n: u32) -> Vec<u32> {
let mut results = Vec::new();
for i in 1..(n / 2 + 1) {
if n % i == 0 {
results.push(i);
}
}
results.push(n);
results
}
/// Calculates whether the divis... | 28.272727 | 78 | 0.557342 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_is_zumkeller() {\n assert_eq!(is_zumkeller_number(0), false);\n assert_eq!(is_zumkeller_number(6), true);\n assert_eq!(is_zumkeller_number(20), true);\n assert_eq!(is_zumkeller_number(21), false);\n assert_eq!... |
f707b18e8abe28cfcee4bc84c64e8ec7a39c3de2 | 8,151 | rs | Rust | clap_complete/src/generator/utils.rs | isudzumi/clap | a5a56d58651281cb7a0f07baae5bfa8ca7bc8e82 | [
"Apache-2.0",
"MIT"
] | null | null | null | clap_complete/src/generator/utils.rs | isudzumi/clap | a5a56d58651281cb7a0f07baae5bfa8ca7bc8e82 | [
"Apache-2.0",
"MIT"
] | null | null | null | clap_complete/src/generator/utils.rs | isudzumi/clap | a5a56d58651281cb7a0f07baae5bfa8ca7bc8e82 | [
"Apache-2.0",
"MIT"
] | null | null | null | //! Helpers for writing generators
use clap::{App, Arg};
/// Gets all subcommands including child subcommands in the form of `("name", "bin_name")`.
///
/// Subcommand `rustup toolchain install` would be converted to
/// `("install", "rustup toolchain install")`.
pub fn all_subcommands(app: &App) -> Vec<(String, Stri... | 30.414179 | 98 | 0.528033 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_subcommands() {\n let app = built_with_version();\n\n assert_eq!(\n subcommands(&app),\n vec![\n (\"test\".to_string(), \"my-app test\".to_string()),\n (\"hello\".to_string(), \"... |
f707b436301947711a2fd0cc285420341657f46f | 2,394 | rs | Rust | stack_priority_queue/src/solution/s0385_mini_parser.rs | kaifoon/leetcode | e251ef6cdb78cd4800a39a0fcc313b32125af51d | [
"Apache-2.0"
] | null | null | null | stack_priority_queue/src/solution/s0385_mini_parser.rs | kaifoon/leetcode | e251ef6cdb78cd4800a39a0fcc313b32125af51d | [
"Apache-2.0"
] | null | null | null | stack_priority_queue/src/solution/s0385_mini_parser.rs | kaifoon/leetcode | e251ef6cdb78cd4800a39a0fcc313b32125af51d | [
"Apache-2.0"
] | null | null | null | #![allow(unused)]
pub struct Solution {}
#[derive(Debug, PartialEq, Eq)]
pub enum NestedInteger {
Int(i32),
List(Vec<NestedInteger>),
}
impl Solution {
// Time O(N), Space O(N) Iterative Solution
pub fn deserialize(s: String) -> NestedInteger {
if !&s.starts_with("[") {
return Nest... | 30.692308 | 90 | 0.419799 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_385() {\n assert_eq!(\n Solution::deserialize(\"324\".to_string()),\n NestedInteger::Int(324)\n );\n assert_eq!(\n Solution::deserialize(\"[123,[456,[789]]]\".to_string()),\n Nest... |
f707e72674925135019f3c2889f561b4debf3d29 | 12,186 | rs | Rust | cryptapath/src/targets/prince.rs | Simula-UiB/CRHS | 8f3dd34c8b99680188d9314c6897e0c790f5358f | [
"MIT"
] | 5 | 2019-11-22T09:22:21.000Z | 2021-04-09T12:56:52.000Z | cryptapath/src/targets/prince.rs | Simula-UiB/CRHS | 8f3dd34c8b99680188d9314c6897e0c790f5358f | [
"MIT"
] | null | null | null | cryptapath/src/targets/prince.rs | Simula-UiB/CRHS | 8f3dd34c8b99680188d9314c6897e0c790f5358f | [
"MIT"
] | 4 | 2020-04-30T13:04:34.000Z | 2021-04-11T01:26:27.000Z | use crate::sbox::Sbox;
use crate::targets::Cipher;
use crate::{bit, bit::Bit, bit::*};
use std::cell::RefCell;
pub struct Prince {
n_rounds: usize,
message_length: usize,
key_length: usize,
constants: Vec<Vec<Bit>>,
inv_table: Vec<u8>,
m_prime: Vec<String>,
whitening: bool,
sbox: RefCel... | 35.631579 | 98 | 0.556951 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn validate_encrypt() {\n let prince = Prince::new(12, true);\n let message = bit::bits_from_hex_string(\"0000000000000000\");\n let key = bit::bits_from_hex_string(\"00000000000000000000000000000000\");\n let ciphertext = p... |
f707e8d4914510e15c0d2541e8f9306dc66da188 | 63,256 | rs | Rust | edgelet/edgelet-docker/tests/runtime.rs | marodev/iotedge | 065bf32973fba25f89327b8756308593d778b3b7 | [
"MIT"
] | null | null | null | edgelet/edgelet-docker/tests/runtime.rs | marodev/iotedge | 065bf32973fba25f89327b8756308593d778b3b7 | [
"MIT"
] | null | null | null | edgelet/edgelet-docker/tests/runtime.rs | marodev/iotedge | 065bf32973fba25f89327b8756308593d778b3b7 | [
"MIT"
] | null | null | null | // Copyright (c) Microsoft. All rights reserved.
#![deny(rust_2018_idioms, warnings)]
#![deny(clippy::all, clippy::pedantic)]
#![allow(clippy::default_trait_access, clippy::too_many_lines)]
use std::collections::{BTreeMap, HashMap};
use std::str;
use std::sync::{Arc, RwLock};
use std::time::Duration;
use failure::Fa... | 31.330362 | 104 | 0.581336 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn image_pull_with_invalid_image_name_fails() {\n let dispatch_table = routes!(\n GET \"/networks\" => default_get_networks_handler(),\n POST \"/networks/create\" => default_create_network_handler(),\n POST \"/images/create\" =>... |
f707f4a58f8724c79e5c628b2905e85910fe694a | 9,909 | rs | Rust | cli/worker.rs | crabmusket/deno | 520bdb6c31dd08b6f4e52de5116fd23d6d57fdda | [
"MIT"
] | null | null | null | cli/worker.rs | crabmusket/deno | 520bdb6c31dd08b6f4e52de5116fd23d6d57fdda | [
"MIT"
] | null | null | null | cli/worker.rs | crabmusket/deno | 520bdb6c31dd08b6f4e52de5116fd23d6d57fdda | [
"MIT"
] | null | null | null | // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use crate::fmt_errors::JSError;
use crate::state::ThreadSafeState;
use crate::tokio_util;
use deno;
use deno::ErrBox;
use deno::ModuleSpecifier;
use deno::StartupData;
use futures::Async;
use futures::Future;
use std::sync::Arc;
use std::sync::M... | 29.756757 | 80 | 0.617015 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn execute_mod_esm_imports_a() {\n let module_specifier =\n ModuleSpecifier::resolve_url_or_path(\"tests/esm_imports_a.js\").unwrap();\n let argv = vec![String::from(\"./deno\"), module_specifier.to_string()];\n let state = ThreadSafeStat... |
f7083653bd7c225a40aadf2840d1999f0867962b | 598 | rs | Rust | src/program/program.rs | ethanfaust/rust-intcode | 29d2eeb23f12493f648369cd47723ac7cfd82335 | [
"MIT"
] | null | null | null | src/program/program.rs | ethanfaust/rust-intcode | 29d2eeb23f12493f648369cd47723ac7cfd82335 | [
"MIT"
] | null | null | null | src/program/program.rs | ethanfaust/rust-intcode | 29d2eeb23f12493f648369cd47723ac7cfd82335 | [
"MIT"
] | null | null | null | #[derive(Debug, PartialEq, Clone)]
pub struct IntCodeProgram {
pub program: Vec<i64>
}
impl IntCodeProgram {
pub fn from_string(input: String) -> IntCodeProgram {
let memory: Vec<i64> = input.split(',')
.map(|x| x.parse::<i64>().unwrap())
.collect();
return IntCodeProgra... | 22.148148 | 78 | 0.560201 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_from_string() {\n let program = IntCodeProgram::from_string(String::from(\"1,0,0,0,99\"));\n assert_eq!(vec![1,0,0,0,99], program.program);\n }\n}"
] |
f70841561a62cd1565585d5cc5d3311af647fcdb | 4,561 | rs | Rust | src/util.rs | delthas/ellidri | e57ad32d28678d0295fa26f4477a3cad65d69eee | [
"ISC"
] | null | null | null | src/util.rs | delthas/ellidri | e57ad32d28678d0295fa26f4477a3cad65d69eee | [
"ISC"
] | null | null | null | src/util.rs | delthas/ellidri | e57ad32d28678d0295fa26f4477a3cad65d69eee | [
"ISC"
] | null | null | null | use rand_chacha::rand_core::{RngCore, SeedableRng};
use rand_chacha::ChaChaRng;
use std::cell::RefCell;
use std::time;
thread_local! {
static RNG: RefCell<ChaChaRng> = RefCell::new(ChaChaRng::seed_from_u64(time::SystemTime::now().duration_since(time::UNIX_EPOCH).unwrap().as_secs()));
}
pub type Masks<'a> = std::s... | 24.788043 | 153 | 0.471826 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_mask_match() {\n let cases = [\n (\"abc\", \"abc\", true),\n (\"*\", \"abc\", true),\n (\"*c\", \"abc\", true),\n (\"a*\", \"a\", true),\n (\"a*\", \"abc\", true),\n (\"a*... |
f708516e5823b9b5b0d7cc7366f38aeee25ba002 | 8,462 | rs | Rust | storage/tests/storage_for_shell.rs | mrjoe7/tezedge | ed4c33ca4ea575e5b8f238ce16575fbf3f9e1001 | [
"MIT"
] | 1 | 2019-11-29T18:25:07.000Z | 2019-11-29T18:25:07.000Z | storage/tests/storage_for_shell.rs | mrjoe7/tezedge | ed4c33ca4ea575e5b8f238ce16575fbf3f9e1001 | [
"MIT"
] | null | null | null | storage/tests/storage_for_shell.rs | mrjoe7/tezedge | ed4c33ca4ea575e5b8f238ce16575fbf3f9e1001 | [
"MIT"
] | null | null | null | // Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::env;
use std::path::{Path, PathBuf};
use failure::Error;
use slog::{Drain, Level, Logger};
use crypto::hash::{chain_id_from_block_hash, ContextHash, HashType};
use storage::*;
use storage::tests_common::TmpStorage;
use t... | 47.80791 | 453 | 0.74415 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_storage() -> Result<(), Error> {\n // logger\n let log = create_logger();\n\n // storage\n let context_dir = PathBuf::from(\"__storage_for_shell\");\n let tmp_storage_dir = test_storage_dir_path(\"__storage_for_shell\");\n let... |
f70888f47b4cec862b5adaae56dc2ade256a044e | 2,540 | rs | Rust | src/utils/num.rs | Turbo87/rust-igc | bb679dc942cb014c32bbe83b85efd05e19567001 | [
"Apache-2.0"
] | 1 | 2018-11-27T21:19:08.000Z | 2018-11-27T21:19:08.000Z | src/utils/num.rs | Turbo87/rust-igc | bb679dc942cb014c32bbe83b85efd05e19567001 | [
"Apache-2.0"
] | 4 | 2018-11-06T15:46:27.000Z | 2019-09-23T06:13:28.000Z | src/utils/num.rs | Turbo87/rust-igc | bb679dc942cb014c32bbe83b85efd05e19567001 | [
"Apache-2.0"
] | null | null | null | use std::str::{FromStr, from_utf8_unchecked};
pub fn parse_int<T: FromStr>(bytes: &[u8]) -> Option<T> {
// `unsafe` here should be okay because `from_str()` converts back
// to `&[u8]` and only cares about ASCII digits
let chars = unsafe { from_utf8_unchecked(bytes) };
<(T)>::from_str(chars).ok()
}
#[... | 32.151899 | 73 | 0.52126 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_parse_int() {\n assert_eq!(parse_int::<u16>(b\"0\"), Some(0));\n assert_eq!(parse_int::<u8>(b\"12\"), Some(12));\n assert_eq!(parse_int::<u16>(b\"2018\"), Some(2018));\n assert_eq!(parse_int::<u32>(b\"2018\"), Some(2... |
f708a15894e34d83c789b3076b58915d1f3de980 | 4,358 | rs | Rust | 17/main.rs | tacgomes/advent-of-code-2018 | 591e4346f9dd7cecf24bc215e8a06f31404405fb | [
"MIT"
] | null | null | null | 17/main.rs | tacgomes/advent-of-code-2018 | 591e4346f9dd7cecf24bc215e8a06f31404405fb | [
"MIT"
] | null | null | null | 17/main.rs | tacgomes/advent-of-code-2018 | 591e4346f9dd7cecf24bc215e8a06f31404405fb | [
"MIT"
] | null | null | null | use regex::Regex;
use std::env;
use std::fs;
use std::path::Path;
use std::process;
#[macro_use]
extern crate lazy_static;
use itertools::Itertools;
lazy_static! {
static ref RE1: Regex = Regex::new(r"x=(\d+), y=(\d+)..(\d+)").unwrap();
static ref RE2: Regex = Regex::new(r"y=(\d+), x=(\d+)..(\d+)").unwrap();
}... | 27.408805 | 88 | 0.494493 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_puzzle_example() {\n let clay_areas = parse_input(\"example.txt\");\n assert_eq!(solve(&clay_areas), (57, 29));\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_puzzle_input() {\n let cl... |
f708bf8c94ae0358ed54b1319097371effc8e2be | 48,811 | rs | Rust | polars/polars-lazy/src/tests/queries.rs | JanKaul/polars | d7bc52e1d9b984e521094bc926e214b8fef417c8 | [
"MIT"
] | null | null | null | polars/polars-lazy/src/tests/queries.rs | JanKaul/polars | d7bc52e1d9b984e521094bc926e214b8fef417c8 | [
"MIT"
] | null | null | null | polars/polars-lazy/src/tests/queries.rs | JanKaul/polars | d7bc52e1d9b984e521094bc926e214b8fef417c8 | [
"MIT"
] | null | null | null | use super::*;
use polars_arrow::prelude::QuantileInterpolOptions;
use polars_core::series::ops::NullBehavior;
#[test]
fn test_lazy_with_column() {
let df = get_df()
.lazy()
.with_column(lit(10).alias("foo"))
.collect()
.unwrap();
println!("{:?}", df);
assert_eq!(df.width(), ... | 24.878186 | 163 | 0.471267 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_lazy_with_column() {\n let df = get_df()\n .lazy()\n .with_column(lit(10).alias(\"foo\"))\n .collect()\n .unwrap();\n println!(\"{:?}\", df);\n assert_eq!(df.width(), 6);\n assert!(df.column(\"foo\").is_o... |
f708df63deff027658ea244b4d70978f8c9ef75e | 2,555 | rs | Rust | tremor-script/src/std_lib/json.rs | m0n0chr0m3/tremor-runtime | de785b5393388a614bc2e7c228dc0a7a98205636 | [
"Apache-2.0"
] | null | null | null | tremor-script/src/std_lib/json.rs | m0n0chr0m3/tremor-runtime | de785b5393388a614bc2e7c228dc0a7a98205636 | [
"Apache-2.0"
] | null | null | null | tremor-script/src/std_lib/json.rs | m0n0chr0m3/tremor-runtime | de785b5393388a614bc2e7c228dc0a7a98205636 | [
"Apache-2.0"
] | null | null | null | // Copyright 2018-2020, Wayfair GmbH
//
// 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... | 32.75641 | 90 | 0.574168 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn decode() {\n let f = fun(\"json\", \"decode\");\n let v = Value::from(r#\"[\"this\",\"is\",\"a\",\"cake\"]\"#);\n assert_val!(f(&[&v]), Value::from(vec![\"this\", \"is\", \"a\", \"cake\"]));\n }\n}",
"#[cfg(test)]\nmod test... |
f70906f84b8692b4e36f2d1145e197ba053d15f8 | 66,111 | rs | Rust | src/libcollections/vec_deque.rs | chrish42/rust | 4ce08a5d70a4dfc4da7ed0bc0098cfd2176b8411 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 6 | 2015-07-29T08:36:14.000Z | 2017-06-27T19:42:04.000Z | src/libcollections/vec_deque.rs | chrish42/rust | 4ce08a5d70a4dfc4da7ed0bc0098cfd2176b8411 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2015-07-29T13:36:15.000Z | 2022-01-29T07:27:02.000Z | src/libcollections/vec_deque.rs | chrish42/rust | 4ce08a5d70a4dfc4da7ed0bc0098cfd2176b8411 | [
"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... | 32.217836 | 100 | 0.465278 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_swap_front_back_remove() {\n fn test(back: bool) {\n // This test checks that every single combination of tail position and length is tested.\n // Capacity 15 should be large enough to cover every case.\n ... |
f70921ce3edb9be5efdbe740df2e55661d134c67 | 1,671 | rs | Rust | vrp-pragmatic/tests/unit/utils/approx_transportation_test.rs | valerivp/vrp | 27ee30e5f4c44e051e5cec1248e606305b52fc00 | [
"Apache-2.0"
] | 1 | 2021-04-06T08:26:03.000Z | 2021-04-06T08:26:03.000Z | vrp-pragmatic/tests/unit/utils/approx_transportation_test.rs | valerivp/vrp | 27ee30e5f4c44e051e5cec1248e606305b52fc00 | [
"Apache-2.0"
] | null | null | null | vrp-pragmatic/tests/unit/utils/approx_transportation_test.rs | valerivp/vrp | 27ee30e5f4c44e051e5cec1248e606305b52fc00 | [
"Apache-2.0"
] | null | null | null | use super::*;
use crate::format::Location;
use vrp_core::models::common::Profile;
use vrp_core::models::problem::{create_matrix_transport_cost, MatrixData};
fn get_test_locations() -> Vec<Location> {
vec![
Location::Coordinate { lat: 52.52599, lng: 13.45413 },
Location::Coordinate { lat: 52.5225, l... | 35.553191 | 110 | 0.650509 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn can_calculate_distance_between_two_locations() {\n let l1 = Location::Coordinate { lat: 52.52599, lng: 13.45413 };\n let l2 = Location::Coordinate { lat: 52.5165, lng: 13.3808 };\n\n let distance = get_distance(&l1, &l2);\n\n assert_eq!(... |
f709605bba77fdca17f8a97d61f67445f6679f85 | 8,279 | rs | Rust | tests/it/bank_model.rs | obsidiandynamics/stride-rs | 517a96ba133ef20af8177701ff7d49f223998879 | [
"MIT"
] | null | null | null | tests/it/bank_model.rs | obsidiandynamics/stride-rs | 517a96ba133ef20af8177701ff7d49f223998879 | [
"MIT"
] | null | null | null | tests/it/bank_model.rs | obsidiandynamics/stride-rs | 517a96ba133ef20af8177701ff7d49f223998879 | [
"MIT"
] | null | null | null | use std::rc::Rc;
use stride::examiner::Record;
use stride::havoc::model::{Model, name_of, rand_element};
use stride::havoc::model::ActionResult::{Blocked, Joined, Ran};
use stride::havoc::model::Retention::{Strong, Weak};
use crate::fixtures::schema::CandidateData;
use crate::fixtures::schema::MessageKind::CandidateM... | 26.116719 | 93 | 0.491122 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn dfs_bank_2x1x1() {\n dfs(&build_model(BankCfg {\n values: &[101, 103],\n num_cohorts: 1,\n txns_per_cohort: 1,\n extents: &[1],\n name: name_of(&dfs_bank_2x1x1),\n }));\n}\n}",
"#[cfg(test)]\nmod tests {\n ... |
f70963044d83e3f5e4cbfb3b09f29a5cdfcf378a | 5,832 | rs | Rust | src/sound_data.rs | hnen/ears | 021a94ba0b0ef71ad38ad26c961d235149768872 | [
"MIT"
] | 89 | 2016-01-23T09:11:10.000Z | 2022-01-21T17:41:41.000Z | src/sound_data.rs | hnen/ears | 021a94ba0b0ef71ad38ad26c961d235149768872 | [
"MIT"
] | 23 | 2016-01-28T23:32:00.000Z | 2021-09-22T13:23:40.000Z | src/sound_data.rs | hnen/ears | 021a94ba0b0ef71ad38ad26c961d235149768872 | [
"MIT"
] | 18 | 2016-02-25T22:06:52.000Z | 2022-01-28T18:40:16.000Z | // The MIT License (MIT)
//
// Copyright (c) 2013 Jeremy Letang (letang.jeremy@gmail.com)
//
// 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 limitati... | 28.173913 | 83 | 0.609053 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn sounddata_create_OK() -> () {\n #![allow(unused_variables)]\n let snd_data = SoundData::new(\"res/shot.wav\").unwrap();\n\n }\n}"
] |
f709b841e047df77598f689982f42579fe62929b | 20,912 | rs | Rust | rust-autograd/src/ops/dot_ops.rs | jiguanglizipao/sgx-mnist | 3d196d27d7b2aafbf1ab4952f4563ee990ed4b1a | [
"MIT"
] | 2 | 2020-06-14T13:54:39.000Z | 2020-06-14T14:09:04.000Z | rust-autograd/src/ops/dot_ops.rs | jiguanglizipao/sgx-mnist | 3d196d27d7b2aafbf1ab4952f4563ee990ed4b1a | [
"MIT"
] | null | null | null | rust-autograd/src/ops/dot_ops.rs | jiguanglizipao/sgx-mnist | 3d196d27d7b2aafbf1ab4952f4563ee990ed4b1a | [
"MIT"
] | null | null | null | use ndarray;
use ndarray_ext::NdArray;
use op;
#[cfg(feature = "mkl")]
use same_type;
#[cfg(feature = "mkl")]
use std::mem;
use tensor::Tensor;
use Float;
#[cfg(feature = "mkl")]
type MklInt = i64;
#[cfg(feature = "mkl")]
#[repr(C)]
#[derive(Clone, Copy, Debug)]
enum CblasTranspose {
CblasNoTrans = 111,
Cblas... | 29.536723 | 100 | 0.475851 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_sgemm() {\n let x = vec![1., 2., 3., 4.]; // (2, 2)\n let y = vec![1., 2., 3., 4.]; // (2, 2)\n let mut z = uninitialized_vec::<f32>(4); // (2, 2, 2)\n\n cblas_sgemm_wrapper(\n false,\n false,\n 2, // m\n 2,... |
f709bbcdd08606d48ab25882256be89f835dc7b5 | 5,315 | rs | Rust | gladis/src/lib.rs | xou816/gladis | 85cf17f51bd42b3f964769ef763c3cb102091c22 | [
"Apache-2.0",
"MIT"
] | null | null | null | gladis/src/lib.rs | xou816/gladis | 85cf17f51bd42b3f964769ef763c3cb102091c22 | [
"Apache-2.0",
"MIT"
] | null | null | null | gladis/src/lib.rs | xou816/gladis | 85cf17f51bd42b3f964769ef763c3cb102091c22 | [
"Apache-2.0",
"MIT"
] | null | null | null | //! Easily import Glade-generated UI files into Rust code.
//!
//! ```
//! use gtk::prelude::*;
//! use gladis::Gladis;
//!
//! const GLADE_SRC: &str = r#"
//! <?xml version="1.0" encoding="UTF-8"?>
//! <!-- Generated with glade 3.22.2 -->
//! <interface>
//! <requires lib="gtk+" version="3.20"/>
//! <object class=... | 27.396907 | 97 | 0.557479 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn fmt_not_found_error() {\n let err = NotFoundError {\n identifier: \"foo\".to_string(),\n typ: \"bar\".to_string(),\n };\n assert_eq!(err.to_string(), \"identifier foo of type bar was not found\");\n }\n}... |
f709d0e63b80a3c1b2a379da98bdf3414f921a01 | 8,198 | rs | Rust | openexr-rs/src/keycode.rs | luke-titley/openexr-bind | 4cbffb2e38fe084350d15d9e3e4acfb4a280d581 | [
"Apache-2.0"
] | null | null | null | openexr-rs/src/keycode.rs | luke-titley/openexr-bind | 4cbffb2e38fe084350d15d9e3e4acfb4a280d581 | [
"Apache-2.0"
] | null | null | null | openexr-rs/src/keycode.rs | luke-titley/openexr-bind | 4cbffb2e38fe084350d15d9e3e4acfb4a280d581 | [
"Apache-2.0"
] | null | null | null | use openexr_sys as sys;
use crate::Error;
type Result<T, E = Error> = std::result::Result<T, E>;
/// A KeyCode object uniquely identifies a motion picture film frame.
/// The following fields specifiy film manufacturer, film type, film
/// roll and the frame's position within the roll.
///
/// # Fields
///
/// * `fi... | 30.589552 | 146 | 0.552086 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_keycode() {\n let mut k = KeyCode::default();\n\n assert!(k.set_film_mfc_code(-1).is_err());\n assert!(k.set_film_mfc_code(1).is_ok());\n assert_eq!(k.film_mfc_code(), 1);\n}\n}"
] |
f709ffce9a2b031f67b061b537005384c94f5db9 | 37,865 | rs | Rust | src/rgb/schema/schema.rs | inbitcoin/rust-lnpbp | 380807a81469a72f233c5dcc2129141280e3318a | [
"MIT"
] | null | null | null | src/rgb/schema/schema.rs | inbitcoin/rust-lnpbp | 380807a81469a72f233c5dcc2129141280e3318a | [
"MIT"
] | null | null | null | src/rgb/schema/schema.rs | inbitcoin/rust-lnpbp | 380807a81469a72f233c5dcc2129141280e3318a | [
"MIT"
] | null | null | null | // LNP/BP Rust Library
// Written in 2020 by
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
//
// 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 warra... | 38.677222 | 156 | 0.458497 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_schema_id_midstate() {\n let midstate = tagged_hash::Midstate::with(b\"rgb:schema\");\n assert_eq!(midstate.into_inner(), MIDSTATE_SHEMA_ID);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_sc... |
f70a030305a1f4a3dfe65533d51a15ceff801d46 | 5,763 | rs | Rust | src/format/ixf.rs | lion328/sc3ktools | 0cf3305e51d1d02113c211435776f1c699381cbe | [
"Apache-2.0"
] | 2 | 2019-05-14T01:36:21.000Z | 2019-08-18T05:32:56.000Z | src/format/ixf.rs | lion328/sc3ktools | 0cf3305e51d1d02113c211435776f1c699381cbe | [
"Apache-2.0"
] | null | null | null | src/format/ixf.rs | lion328/sc3ktools | 0cf3305e51d1d02113c211435776f1c699381cbe | [
"Apache-2.0"
] | 1 | 2018-12-02T19:14:09.000Z | 2018-12-02T19:14:09.000Z | use std::io::{self, Read, Write, Cursor};
use error::*;
use byteorder::{ReadBytesExt, WriteBytesExt, LE};
pub const IXF_FILE_HEADER_IDENTIFIER: &[u8] = &[0xD7, 0x81, 0xC3, 0x80];
pub const IXF_FILE_RECORD_LENGTH: usize = 20;
pub const IXF_FILE_NULL_RECORD: &[u8] = &[0u8; IXF_FILE_RECORD_LENGTH];
#[derive(Debug, Parti... | 27.975728 | 115 | 0.50321 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn invalid_header() {\n let data = [0xDE, 0xAD, 0xBA, 0xBE, 0xFA, 0x11];\n IXFFile::parse(&data, true).unwrap();\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn normal() {\n let data = [\n 0x... |
f70a14fc758518f48f6f5ea2bc43e4a385188151 | 33,096 | rs | Rust | src/gen.rs | gudjonragnar/rsgen-avro | c46fd1eb73239e151f7cb38e607c68a096ea3d62 | [
"MIT"
] | null | null | null | src/gen.rs | gudjonragnar/rsgen-avro | c46fd1eb73239e151f7cb38e607c68a096ea3d62 | [
"MIT"
] | null | null | null | src/gen.rs | gudjonragnar/rsgen-avro | c46fd1eb73239e151f7cb38e607c68a096ea3d62 | [
"MIT"
] | null | null | null | use std::collections::{HashMap, VecDeque};
use std::fs;
use std::io::prelude::*;
use avro_rs::{schema::RecordField, Schema};
use crate::error::{Error, Result};
use crate::templates::*;
/// Represents a schema input source.
pub enum Source<'a> {
/// An Avro schema enum from `avro-rs` crate.
Schema(&'a Schema)... | 27.58 | 110 | 0.511965 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn simple() {\n let raw_schema = r#\"\n{\n \"type\": \"record\",\n \"name\": \"test\",\n \"fields\": [\n {\"name\": \"a\", \"type\": \"long\", \"default\": 42},\n {\"name\": \"b\", \"type\": \"string\"}\n ]\n}\n\"#;\n\n let expe... |
f70a3e216f29d7a2a06ddf436f4868ffebf9601f | 19,775 | rs | Rust | src/state.rs | carlad/amethyst | 8f026945c60dceba2b383e86cb46703e0ee8f362 | [
"MIT"
] | null | null | null | src/state.rs | carlad/amethyst | 8f026945c60dceba2b383e86cb46703e0ee8f362 | [
"MIT"
] | null | null | null | src/state.rs | carlad/amethyst | 8f026945c60dceba2b383e86cb46703e0ee8f362 | [
"MIT"
] | null | null | null | //! Utilities for game state management.
use amethyst_input::is_close_requested;
use crate::{ecs::prelude::World, GameData, StateEvent};
use std::fmt::Result as FmtResult;
use std::fmt::{Display, Formatter};
/// Error type for errors occurring in StateMachine
#[derive(Debug)]
pub enum StateError {
NoStatesPrese... | 36.217949 | 121 | 0.598281 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn switch_pop() {\n use crate::ecs::prelude::World;\n\n let mut world = World::new();\n\n let mut sm = StateMachine::new(State1(7));\n // Unwrap here is fine because start can only fail when there are no states in the machin... |
f70a86cf4eddd096740db19ebf13c998e75da57b | 6,256 | rs | Rust | src/lib.rs | pirogoeth/unix-named-pipe | 78bd325c82d13451027bc0b5c686f972358b8e9a | [
"MIT"
] | 6 | 2018-10-15T00:00:13.000Z | 2019-12-24T18:30:29.000Z | src/lib.rs | pirogoeth/unix-named-pipe | 78bd325c82d13451027bc0b5c686f972358b8e9a | [
"MIT"
] | 1 | 2018-10-13T19:30:57.000Z | 2018-10-18T05:14:40.000Z | src/lib.rs | pirogoeth/unix-named-pipe | 78bd325c82d13451027bc0b5c686f972358b8e9a | [
"MIT"
] | 3 | 2018-12-02T19:10:19.000Z | 2021-12-26T14:50:16.000Z | //! Provides utilities for working with Unix named pipes / FIFOs.
extern crate errno;
extern crate libc;
use libc::{c_int, mkfifo, mode_t, EACCES, EEXIST, ENOENT};
use std::ffi::CString;
use std::fs::{File, OpenOptions};
use std::io;
use std::os::unix::fs::OpenOptionsExt;
use std::path::Path;
mod ext;
pub use self::e... | 29.370892 | 96 | 0.570013 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn create_new_pipe() {\n let lock = lock_active_test().unwrap();\n\n let filename = \"/tmp/pipe\";\n let _ = create(filename, None).expect(\"could not create pipe\");\n\n fs::remove_file(filename).expect(\"could not remove t... |
f70ac7c6614c85b2df4167ffe78066d0e898d8cc | 14,794 | rs | Rust | compiler/src/util.rs | aviansie-ben/yet-another-static-java-compiler | 9207c1579e0f555ff1cd83a09b380f7415270d36 | [
"MIT"
] | 2 | 2020-09-28T18:13:22.000Z | 2020-10-14T20:32:45.000Z | compiler/src/util.rs | aviansie-ben/yet-another-static-java-compiler | 9207c1579e0f555ff1cd83a09b380f7415270d36 | [
"MIT"
] | null | null | null | compiler/src/util.rs | aviansie-ben/yet-another-static-java-compiler | 9207c1579e0f555ff1cd83a09b380f7415270d36 | [
"MIT"
] | null | null | null | use std::cell::UnsafeCell;
use std::collections::HashMap;
use std::hash::Hash;
use std::iter;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
fn into_pos(i: usize) -> (usize, u8) {
(i >> 3, (i & 0x7) as u8)
}
fn from_pos(byte: usize, bit: u8) -> usize {
(byte << 3) + (bit as usize)
}
pub trait... | 23.371248 | 112 | 0.485873 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_get_set() {\n let mut bv: BitVec<usize> = BitVec::new();\n\n assert!(!bv.get(0));\n assert!(!bv.get(7));\n assert!(!bv.get(8));\n\n bv.set(7, true);\n\n assert!(!bv.get(0));\n assert!(bv.get(7));... |
f70ada07f6383a0db7eb2213219007814f903710 | 317 | rs | Rust | tests/integration_test.rs | HaoXuan40404/num-primes | 36e83873f89c8f082a3c11ecb6cc2c6b52487a45 | [
"Apache-2.0",
"MIT"
] | 3 | 2021-09-27T07:47:46.000Z | 2021-12-26T14:44:27.000Z | tests/integration_test.rs | HaoXuan40404/num-primes | 36e83873f89c8f082a3c11ecb6cc2c6b52487a45 | [
"Apache-2.0",
"MIT"
] | 3 | 2021-09-15T13:29:37.000Z | 2021-12-23T08:52:37.000Z | tests/integration_test.rs | HaoXuan40404/num-primes | 36e83873f89c8f082a3c11ecb6cc2c6b52487a45 | [
"Apache-2.0",
"MIT"
] | 6 | 2021-09-15T20:54:22.000Z | 2021-12-20T04:07:51.000Z | use num_primes::{Generator,Verification};
#[cfg(test)]
#[test]
fn generate_all(){
let prime = Generator::new_prime(512);
let _uint = Generator::new_uint(1024);
// p = 2q + 1 || where p is safe prime
let _safe_prime = Generator::safe_prime(64);
let _ver: bool = Verification::is_prime(&prime);
} | 24.384615 | 52 | 0.659306 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn generate_all(){\n let prime = Generator::new_prime(512);\n let _uint = Generator::new_uint(1024);\n\n // p = 2q + 1 || where p is safe prime\n let _safe_prime = Generator::safe_prime(64);\n\n let _ver: bool = Verification::is_prime(&p... |
f70ae028a39cf6a8029824ff7af69f52ace580c5 | 12,705 | rs | Rust | vulkano/src/command_buffer/submit/queue_submit.rs | stephan-cr/vulkano | 65254ed10c81694e45555e6044851b718ae200c0 | [
"Apache-2.0",
"MIT"
] | null | null | null | vulkano/src/command_buffer/submit/queue_submit.rs | stephan-cr/vulkano | 65254ed10c81694e45555e6044851b718ae200c0 | [
"Apache-2.0",
"MIT"
] | null | null | null | vulkano/src/command_buffer/submit/queue_submit.rs | stephan-cr/vulkano | 65254ed10c81694e45555e6044851b718ae200c0 | [
"Apache-2.0",
"MIT"
] | null | null | null | // Copyright (c) 2017 The vulkano developers
// 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. All files in the project carrying such
// notice may not be ... | 34.808219 | 124 | 0.612908 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn empty_submit() {\n let (device, queue) = gfx_dev_and_queue!();\n let builder = SubmitCommandBufferBuilder::new();\n builder.submit(&queue).unwrap();\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n f... |
f70aefdc6ff193308fc2c53b58c13d38ef53b42b | 4,752 | rs | Rust | src/bls12_381/fq12.rs | nearprotocol/pairing | f009a9f54c1c1149cea4ee3e6e58ed71d72bb2e9 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/bls12_381/fq12.rs | nearprotocol/pairing | f009a9f54c1c1149cea4ee3e6e58ed71d72bb2e9 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/bls12_381/fq12.rs | nearprotocol/pairing | f009a9f54c1c1149cea4ee3e6e58ed71d72bb2e9 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | use rand::{Rng};
use {Field, Rand};
use super::fq6::Fq6;
use super::fq2::Fq2;
use super::fq::FROBENIUS_COEFF_FQ12_C1;
/// An element of Fq12, represented by c0 + c1 * w.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Fq12 {
pub c0: Fq6,
pub c1: Fq6,
}
impl ::std::fmt::Display for Fq12 {
fn fmt(&s... | 23.879397 | 84 | 0.506103 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_fq12_mul_by_014() {\n let mut rng = XorShiftRng::seed_from_u64(0x5dbe62598d313d76);\n\n for _ in 0..1000 {\n let c0 = Fq2::rand(&mut rng);\n let c1 = Fq2::rand(&mut rng);\n let c5 = Fq2::rand(&mut rng);\n let m... |
f70b28bac903cff32e47bb56f114b95321666e07 | 637 | rs | Rust | leetcode/src/math/leetcode1362.rs | SmiteWindows/leetcode | 010d7e714c5a960dbb23a07f4aba85bba3450aad | [
"MIT"
] | 1 | 2021-05-13T16:15:20.000Z | 2021-05-13T16:15:20.000Z | leetcode/src/math/leetcode1362.rs | SmiteWindows/leetcode | 010d7e714c5a960dbb23a07f4aba85bba3450aad | [
"MIT"
] | null | null | null | leetcode/src/math/leetcode1362.rs | SmiteWindows/leetcode | 010d7e714c5a960dbb23a07f4aba85bba3450aad | [
"MIT"
] | null | null | null | // https://leetcode-cn.com/problems/closest-divisors/
// Runtime: 4 ms
// Memory Usage: 2.1 MB
pub fn closest_divisors(num: i32) -> Vec<i32> {
for i in (0..=((num + 2) as f64).sqrt() as i32).rev() {
if (num + 1) % i == 0 {
return vec![(num + 1) / i, i];
}
if (num + 2) % i == 0 {
... | 27.695652 | 59 | 0.518053 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test1_1362() {\n assert_eq!(closest_divisors(8), vec![3, 3]);\n // assert_eq!(closest_divisors(123), vec![5, 25]);\n assert_eq!(closest_divisors(123), vec![25, 5]);\n assert_eq!(closest_divisors(999), vec![40, 25]);\n}\n}"
] |
f70b448c233bcf5e81dc8f8c610124120e9ff078 | 4,515 | rs | Rust | git-attributes/tests/match_group/mod.rs | Byron/grit | 61abb0b006292d2122784b032e198cc716fb7b92 | [
"Apache-2.0",
"MIT"
] | 149 | 2020-07-07T09:56:14.000Z | 2020-07-30T15:12:14.000Z | git-attributes/tests/match_group/mod.rs | Byron/grit | 61abb0b006292d2122784b032e198cc716fb7b92 | [
"Apache-2.0",
"MIT"
] | 4 | 2020-06-29T06:53:11.000Z | 2020-07-25T04:04:14.000Z | git-attributes/tests/match_group/mod.rs | Byron/grit | 61abb0b006292d2122784b032e198cc716fb7b92 | [
"Apache-2.0",
"MIT"
] | 2 | 2020-07-12T18:25:01.000Z | 2020-07-24T08:45:22.000Z | mod ignore {
use std::io::Read;
use bstr::{BStr, ByteSlice};
use git_attributes::{Ignore, Match, MatchGroup};
use git_glob::pattern::Case;
struct Expectations<'a> {
lines: bstr::Lines<'a>,
}
impl<'a> Iterator for Expectations<'a> {
type Item = (&'a BStr, Option<(&'a BStr, ... | 37.941176 | 117 | 0.512957 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn from_git_dir() -> crate::Result {\n let dir = git_testtools::scripted_fixture_repo_read_only(\"make_global_and_external_and_dir_ignores.sh\")?;\n let repo_dir = dir.join(\"repo\");\n let git_dir = repo_dir.join(\".git\");\n ... |
f70b5d5bfc40fed77af51f7f59c346a1b188c2f4 | 17,545 | rs | Rust | russell_sparse/src/sparse_triplet.rs | cpmech/russell | 4297f524182b88a384232277293cbb1324d1cfb7 | [
"MIT"
] | 7 | 2021-07-13T00:47:29.000Z | 2021-12-12T23:06:01.000Z | russell_sparse/src/sparse_triplet.rs | cpmech/russell | 4297f524182b88a384232277293cbb1324d1cfb7 | [
"MIT"
] | 7 | 2021-06-21T13:30:22.000Z | 2021-09-07T12:49:47.000Z | russell_sparse/src/sparse_triplet.rs | cpmech/russell | 4297f524182b88a384232277293cbb1324d1cfb7 | [
"MIT"
] | 1 | 2021-06-25T00:12:54.000Z | 2021-06-25T00:12:54.000Z | use super::Symmetry;
use russell_lab::{Matrix, Vector};
use russell_openblas::to_i32;
use std::fmt;
/// Holds triples (i,j,aij) representing a sparse matrix
///
/// # Remarks
///
/// - Only the non-zero values are required
/// - Entries with repeated (i,j) indices are allowed
/// - Repeated (i,j) entries will have the... | 32.430684 | 142 | 0.450385 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn new_fails_on_wrong_input() {\n assert_eq!(\n SparseTriplet::new(0, 3, 5, Symmetry::No).err(),\n Some(\"nrow, ncol, and max must all be greater than zero\")\n );\n assert_eq!(\n SparseTriplet::new... |
f70b754f13d0d04e13365ea7b421ccc4528f7c8f | 5,560 | rs | Rust | src/params.rs | sansare/stripe-rs | ae1df580bc40f46329d80ff85347c376958b0411 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/params.rs | sansare/stripe-rs | ae1df580bc40f46329d80ff85347c376958b0411 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/params.rs | sansare/stripe-rs | ae1df580bc40f46329d80ff85347c376958b0411 | [
"Apache-2.0",
"MIT"
] | 3 | 2019-06-05T23:35:07.000Z | 2020-08-01T18:43:37.000Z | use crate::config::{err, ok, Client, Response};
use crate::error::Error;
use serde::de::DeserializeOwned;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Clone, Default)]
pub struct Headers {
pub stripe_account: Option<String>,
pub client_id: Option<String>,
}
pub trait Ide... | 29.574468 | 98 | 0.572482 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn to_snakecase() {\n use super::to_snakecase;\n\n assert_eq!(to_snakecase(\"snake_case\").as_str(), \"snake_case\");\n assert_eq!(to_snakecase(\"CamelCase\").as_str(), \"camel_case\");\n assert_eq!(to_snakecase(\"XMLHttpReq... |
f70ba1ccc460032fcccf14a03737d60b6aedcb2a | 69,906 | rs | Rust | r1cs-std/src/bits/boolean.rs | mrmr1993/zexe | 04dbf643a8aa4231bb2051ae8f3c0798fdd33f10 | [
"Apache-2.0",
"MIT"
] | 1 | 2022-03-21T15:44:00.000Z | 2022-03-21T15:44:00.000Z | r1cs-std/src/bits/boolean.rs | mrmr1993/zexe | 04dbf643a8aa4231bb2051ae8f3c0798fdd33f10 | [
"Apache-2.0",
"MIT"
] | null | null | null | r1cs-std/src/bits/boolean.rs | mrmr1993/zexe | 04dbf643a8aa4231bb2051ae8f3c0798fdd33f10 | [
"Apache-2.0",
"MIT"
] | null | null | null | use algebra::{BitIterator, Field, FpParameters, PrimeField};
use crate::{prelude::*, Assignment};
use r1cs_core::{ConstraintSystem, LinearCombination, SynthesisError, Variable};
use std::borrow::Borrow;
/// Represents a variable in the constraint system which is guaranteed
/// to be either zero or one.
#[derive(Copy,... | 36.812006 | 100 | 0.412711 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_boolean_to_byte() {\n for val in [true, false].iter() {\n let mut cs = TestConstraintSystem::<Fr>::new();\n let a: Boolean = AllocatedBit::alloc(&mut cs, || Ok(*val)).unwrap().into();\n let bytes = a.to_b... |
f70bcbcc41ebc80cd725e2cbd01bc20fef7736db | 2,917 | rs | Rust | rust/src/day13.rs | bwestlin/advent-of-code-2020 | 9377c8953fe10db5f14c80630effc07cc79cfb15 | [
"MIT"
] | null | null | null | rust/src/day13.rs | bwestlin/advent-of-code-2020 | 9377c8953fe10db5f14c80630effc07cc79cfb15 | [
"MIT"
] | null | null | null | rust/src/day13.rs | bwestlin/advent-of-code-2020 | 9377c8953fe10db5f14c80630effc07cc79cfb15 | [
"MIT"
] | null | null | null | extern crate utils;
use std::env;
use std::io::{self, BufReader};
use std::io::prelude::*;
use std::fs::File;
use utils::*;
#[derive(Debug)]
struct Input {
earliest_ts: u64,
bus_ids: Vec<Option<u64>>
}
fn part1(input: &Input) -> u64 {
let (least_wait, bus_id) = input.bus_ids.iter()
.flatten()
... | 26.279279 | 118 | 0.494001 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_part1() {\n assert_eq!(part1(&as_input(INPUT)), 295);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_part2() {\n assert_eq!(part2(&as_input(INPUT)), 1068781);\n assert_eq!(part2(&as_in... |
f70bd9a6a5db943516d37dd020c5d4a0ba47e6ad | 619 | rs | Rust | src/y2019/star09/mod.rs | tm-drtina/advent-of-code | d16b44ee258c8fc4e992d162891fdd87f02aa02e | [
"MIT"
] | null | null | null | src/y2019/star09/mod.rs | tm-drtina/advent-of-code | d16b44ee258c8fc4e992d162891fdd87f02aa02e | [
"MIT"
] | null | null | null | src/y2019/star09/mod.rs | tm-drtina/advent-of-code | d16b44ee258c8fc4e992d162891fdd87f02aa02e | [
"MIT"
] | null | null | null | pub mod part1;
pub mod part2;
#[cfg(test)]
mod tests {
#[test]
fn part1() {
let expected = 3780860499_i64;
let actual = super::part1::run(include_str!("input.txt"));
assert_eq!(expected, actual);
}
#[test]
fn part1_sanity() {
let expected = 99_i64;
let actual... | 24.76 | 100 | 0.563813 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn part1() {\n let expected = 3780860499_i64;\n let actual = super::part1::run(include_str!(\"input.txt\"));\n assert_eq!(expected, actual);\n }\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn part1_san... |
f70c220afec4c54e46be629a40cd6163a655f314 | 23,584 | rs | Rust | src/cargo.rs | AtkinsChang/tarpaulin | a8cf5cfebbc5d9aed03bdfcef4a2b76c088d3aea | [
"Apache-2.0",
"MIT"
] | null | null | null | src/cargo.rs | AtkinsChang/tarpaulin | a8cf5cfebbc5d9aed03bdfcef4a2b76c088d3aea | [
"Apache-2.0",
"MIT"
] | null | null | null | src/cargo.rs | AtkinsChang/tarpaulin | a8cf5cfebbc5d9aed03bdfcef4a2b76c088d3aea | [
"Apache-2.0",
"MIT"
] | null | null | null | use crate::config::*;
use crate::errors::RunError;
use crate::path_utils::get_source_walker;
use cargo_metadata::{diagnostic::DiagnosticLevel, CargoOpt, Message, Metadata, MetadataCommand};
use lazy_static::lazy_static;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use... | 32 | 100 | 0.530868 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn llvm_cov_compatible_version() {\n let version = CargoVersionInfo {\n major: 1,\n minor: 50,\n channel: Channel::Nightly,\n year: 2020,\n month: 12,\n day: 22,\n };\n ... |
f70c2aa6145e620821f0446e582e12053a7011a9 | 3,770 | rs | Rust | src/notification/tests.rs | vishy1618/gcm | e88306683a6b5783cc14d83a60d1cc2847bfb46b | [
"MIT"
] | 7 | 2015-12-28T11:58:49.000Z | 2020-03-25T10:44:35.000Z | src/notification/tests.rs | vishy1618/gcm | e88306683a6b5783cc14d83a60d1cc2847bfb46b | [
"MIT"
] | 6 | 2015-10-29T13:24:11.000Z | 2017-06-03T13:27:53.000Z | src/notification/tests.rs | vishy1618/gcm | e88306683a6b5783cc14d83a60d1cc2847bfb46b | [
"MIT"
] | 5 | 2015-12-28T07:12:03.000Z | 2019-06-05T17:44:40.000Z | use serde_json;
use {NotificationBuilder};
#[test]
fn should_create_new_notification_message() {
let nm = NotificationBuilder::new("title").finalize();
assert_eq!(nm.title, "title");
}
#[test]
fn should_set_notification_body() {
let nm = NotificationBuilder::new("title").finalize();
assert_eq!(nm.body, None... | 22.848485 | 101 | 0.664191 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn should_create_new_notification_message() {\n let nm = NotificationBuilder::new(\"title\").finalize();\n\n assert_eq!(nm.title, \"title\");\n}\n}",
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn should_set_notification_body() ... |
f70ca87e304a91961d5b1c62f1b24204d6a9d3e7 | 616 | rs | Rust | src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs | randomicon00/rust | 4e02a9281dd8c74cf5c04df044659b5e03b17571 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs | randomicon00/rust | 4e02a9281dd8c74cf5c04df044659b5e03b17571 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | src/test/ui/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs | randomicon00/rust | 4e02a9281dd8c74cf5c04df044659b5e03b17571 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | // compile-flags: --test
// run-pass
// `generic_assert` is completely unimplemented and doesn't generate any logic, thus the
// reason why this test currently passes
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
use std::fmt::{Debug, Formatter};
#[derive(Clone, Copy, PartialEq)]
struct Copy... | 22.814815 | 88 | 0.696429 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test() {\n let _copy_debug = CopyDebug(1);\n assert!(_copy_debug == CopyDebug(3));\n}\n}"
] |
f70ce9ae0aa5eb80a4e82f5cf03c159b897730bb | 3,516 | rs | Rust | tests/test_module.rs | Hanaasagi/pyo3 | 3e7a823dee2c4574534deb3cba28b2f1e2149047 | [
"Apache-2.0"
] | null | null | null | tests/test_module.rs | Hanaasagi/pyo3 | 3e7a823dee2c4574534deb3cba28b2f1e2149047 | [
"Apache-2.0"
] | null | null | null | tests/test_module.rs | Hanaasagi/pyo3 | 3e7a823dee2c4574534deb3cba28b2f1e2149047 | [
"Apache-2.0"
] | null | null | null | #![feature(specialization)]
#[macro_use]
extern crate pyo3;
use pyo3::prelude::*;
use pyo3::types::PyDict;
#[macro_use]
mod common;
#[pyclass]
struct EmptyClass {}
fn sum_as_string(a: i64, b: i64) -> String {
format!("{}", a + b).to_string()
}
#[pyfunction]
/// Doubles the given value
fn double(x: usize) -> u... | 23.918367 | 89 | 0.618316 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_module_with_functions() {\n let gil = Python::acquire_gil();\n let py = gil.python();\n\n let d = PyDict::new(py);\n d.set_item(\"module_with_functions\", unsafe {\n PyObject::from_owned_ptr(py, PyInit_module_with_functions())\n ... |
f70d2ae02eda0602866e59b7326ceaa29a45628b | 4,384 | rs | Rust | src/image.rs | ruimo/remove_docker_images | f170cb878c6c250e3c80b2f43250ffc7fe443ad1 | [
"Apache-2.0"
] | null | null | null | src/image.rs | ruimo/remove_docker_images | f170cb878c6c250e3c80b2f43250ffc7fe443ad1 | [
"Apache-2.0"
] | null | null | null | src/image.rs | ruimo/remove_docker_images | f170cb878c6c250e3c80b2f43250ffc7fe443ad1 | [
"Apache-2.0"
] | null | null | null | use std::hash::{Hash, Hasher};
use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt;
use super::version;
#[cfg(test)]
use super::image;
pub struct ImageEntry {
pub id: String,
pub ver: version::Version,
}
impl PartialEq for ImageEntry {
fn eq(&self, other: &Self) -> bool {
... | 37.793103 | 111 | 0.592838 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn delete_test() {\n let parser = version::parser();\n let mut map: HashMap<String, HashSet<image::ImageEntry>> = HashMap::new();\n let mut entries0 = HashSet::new();\n entries0.insert(ImageEntry { id: \"id00\".to_string(), ver: parser.pars... |
f70dea4da58e2605a6aa3c9e559bb12a5b02e8af | 17,196 | rs | Rust | src/test.rs | Mapet13/Chip-8-VM-Emulator | a3ad03b338b9159e3b9738ac274489a720f3e5ca | [
"MIT"
] | null | null | null | src/test.rs | Mapet13/Chip-8-VM-Emulator | a3ad03b338b9159e3b9738ac274489a720f3e5ca | [
"MIT"
] | null | null | null | src/test.rs | Mapet13/Chip-8-VM-Emulator | a3ad03b338b9159e3b9738ac274489a720f3e5ca | [
"MIT"
] | null | null | null | #![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use super::*;
use crate::instructions::decode_opcode;
fn get_vm() -> Chip8VM {
Chip8VM {
waiting_for_key_press: false,
key_index_store: 0x00,
display_data: [false; DISPLAY_SIZE[0] * DISPLAY_SIZE[1]],
memory: [... | 25.400295 | 142 | 0.625901 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_00E0() {\n // 0x00E0 - Clear the screen\n\n let opcode = 0x00E0;\n let mut vm = get_vm();\n\n vm.display_data = [true; DISPLAY_SIZE[0] * DISPLAY_SIZE[1]];\n\n vm.execute_instruction(decode_opcode(opcode), opcode);\n\n for i in... |
f70df399b0a72a78e3e37b91ac3e1749fedfca9e | 29,263 | rs | Rust | src/log_specification.rs | petreeftime/flexi_logger | 6ccc89f9aa12b15971ab82bd0e7456fc3d7d127d | [
"Apache-2.0",
"MIT"
] | null | null | null | src/log_specification.rs | petreeftime/flexi_logger | 6ccc89f9aa12b15971ab82bd0e7456fc3d7d127d | [
"Apache-2.0",
"MIT"
] | null | null | null | src/log_specification.rs | petreeftime/flexi_logger | 6ccc89f9aa12b15971ab82bd0e7456fc3d7d127d | [
"Apache-2.0",
"MIT"
] | null | null | null | use crate::flexi_error::FlexiLoggerError;
use crate::LevelFilter;
#[cfg(feature = "textfilter")]
use regex::Regex;
use std::collections::HashMap;
use std::env;
///
/// Immutable struct that defines which loglines are to be written,
/// based on the module, the log level, and the text.
///
/// The loglevel specificati... | 33.713134 | 104 | 0.548235 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn parse_logging_spec_valid() {\n let spec = LogSpecification::parse(\"crate1::mod1=error,crate1::mod2,crate2=debug\").unwrap();\n assert_eq!(spec.module_filters().len(), 3);\n assert_eq!(\n spec.module_filters()[0].modu... |
f70dfe34c32ffec9981c08d030fea8ac667d5b78 | 1,583 | rs | Rust | src/test/instruction_tests/instr_ucomiss.rs | epakskape/rust-x86asm | adb4128f7b12642336a919e32bd56509c9a835d4 | [
"MIT"
] | 49 | 2017-10-31T10:26:54.000Z | 2021-07-06T09:04:12.000Z | src/test/instruction_tests/instr_ucomiss.rs | epakskape/rust-x86asm | adb4128f7b12642336a919e32bd56509c9a835d4 | [
"MIT"
] | 6 | 2018-02-28T05:57:28.000Z | 2020-01-05T01:54:41.000Z | src/test/instruction_tests/instr_ucomiss.rs | epakskape/rust-x86asm | adb4128f7b12642336a919e32bd56509c9a835d4 | [
"MIT"
] | 7 | 2018-09-09T13:08:16.000Z | 2020-06-14T00:06:07.000Z | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
#[test]
fn ucomiss_1() {
run_test(&Instruction { mnemonic: Mnemonic::UCOMISS, operand1: Some(Direct(... | 54.586207 | 382 | 0.706254 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn ucomiss_1() {\n run_test(&Instruction { mnemonic: Mnemonic::UCOMISS, operand1: Some(Direct(XMM1)), operand2: Some(Direct(XMM7)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast... |
f70e4881bdb5a408a540a0fae2a3e59e0be26bc3 | 7,080 | rs | Rust | molt/src/util.rs | rfdonnelly/molt | 872fc769c1290cd5f0bc775262b431448c9e1d06 | [
"BSD-3-Clause"
] | null | null | null | molt/src/util.rs | rfdonnelly/molt | 872fc769c1290cd5f0bc775262b431448c9e1d06 | [
"BSD-3-Clause"
] | null | null | null | molt/src/util.rs | rfdonnelly/molt | 872fc769c1290cd5f0bc775262b431448c9e1d06 | [
"BSD-3-Clause"
] | null | null | null | //! Internal Utilities
//!
//! This module contains function for use by molt only.
use crate::tokenizer::Tokenizer;
pub fn is_varname_char(ch: char) -> bool {
ch.is_alphanumeric() || ch == '_'
}
/// Reads the integer string from the head of the input. If the function returns `Some`,
/// the value is the integer... | 28.897959 | 96 | 0.535169 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_util_read_int() {\n let mut p = Tokenizer::new(\"abc\");\n assert_eq!(None, read_int(&mut p));\n assert_eq!(Some('a'), p.peek());\n\n let mut p = Tokenizer::new(\"-abc\");\n assert_eq!(None, read_int(&mut p));... |
f70e5f429013b177c34272f9f70d21669efdc248 | 29,196 | rs | Rust | src/postings/segment_postings.rs | Frando/tantivy | 35236c8634297cbb7dd3302d519d7c1a776439f5 | [
"MIT"
] | 1 | 2019-07-19T02:15:02.000Z | 2019-07-19T02:15:02.000Z | src/postings/segment_postings.rs | Frando/tantivy | 35236c8634297cbb7dd3302d519d7c1a776439f5 | [
"MIT"
] | null | null | null | src/postings/segment_postings.rs | Frando/tantivy | 35236c8634297cbb7dd3302d519d7c1a776439f5 | [
"MIT"
] | null | null | null | use crate::common::BitSet;
use crate::common::HasLen;
use crate::common::{BinarySerializable, VInt};
use crate::docset::{DocSet, SkipResult};
use crate::positions::PositionReader;
use crate::postings::compression::{compressed_block_size, AlignedBuffer};
use crate::postings::compression::{BlockDecoder, VIntDecoder, COMP... | 36.268323 | 130 | 0.587717 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_empty_segment_postings() {\n let mut postings = SegmentPostings::empty();\n assert!(!postings.advance());\n assert!(!postings.advance());\n assert_eq!(postings.len(), 0);\n }\n}",
"#[cfg(test)]\nmod tests {\n ... |
f70e93a80ef1055a5f6ea053ca2a4787a45d68de | 26,854 | rs | Rust | src/context.rs | polachok/swagger-rs | 569b50f39982c4634d041a322afa008b6f10e2e3 | [
"Apache-2.0"
] | null | null | null | src/context.rs | polachok/swagger-rs | 569b50f39982c4634d041a322afa008b6f10e2e3 | [
"Apache-2.0"
] | null | null | null | src/context.rs | polachok/swagger-rs | 569b50f39982c4634d041a322afa008b6f10e2e3 | [
"Apache-2.0"
] | null | null | null | //! Module for API context management.
//!
//! This module defines traits and structs that can be used to manage
//! contextual data related to a request, as it is passed through a series of
//! hyper services.
//!
//! See the `context_tests` module below for examples of how to use.
use super::XSpanIdString;
use auth... | 32.510896 | 99 | 0.569785 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn send_request() {\n // annotate the outermost service to indicate that the context type it\n // uses is the empty context type created by the above macro invocation.\n // the compiler should infer all the other context types.\n ... |
f70f027b8fd4e415817fb8f72201010519cffc7b | 4,474 | rs | Rust | src/tetrominos/z.rs | ThibautGeriz/tetris | 2f99998fc05fe1e120f4a7d69801c05b95e110e4 | [
"MIT"
] | null | null | null | src/tetrominos/z.rs | ThibautGeriz/tetris | 2f99998fc05fe1e120f4a7d69801c05b95e110e4 | [
"MIT"
] | 9 | 2021-01-04T18:25:19.000Z | 2021-01-06T20:16:10.000Z | src/tetrominos/z.rs | ThibautGeriz/tetris | 2f99998fc05fe1e120f4a7d69801c05b95e110e4 | [
"MIT"
] | null | null | null | use super::{Tetromino, TetrominoCommon, SQUARE_COUNT};
use crate::color::Color;
use crate::playground::Playground;
use crate::playground::COLUMN_COUNT;
#[allow(unused_imports)]
use rand::{thread_rng, Error, Rng, RngCore};
const COLOR: Color = Color::Red;
pub struct Z {
squares: [usize; SQUARE_COUNT],
}
impl Z {
... | 29.629139 | 88 | 0.595887 | [
"#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn insert_into_playground_true() {\n // given\n let mut fake_random = get_fake_rand(2);\n let mut playground = Playground::new();\n let tetromino = Z::create(&mut fake_random);\n\n // when\n let is_inserted =\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.