View example_setup_teardown.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::panic; | |
use rstest::*; | |
fn setup(){ | |
println!("setup 111"); | |
} | |
fn teardown(){ | |
println!("teardown 2222"); |
View example_rstest.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rstest::*; | |
use std::sync::Once; | |
static INIT: Once = Once::new(); | |
#[fixture] | |
pub fn setup() -> () { | |
INIT.call_once(|| { | |
println!("Hello, world!"); | |
// initialization code here |
View main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let s1=String::from("ラウトは難しいです!"); | |
let len = calculate_length(&s1); | |
let chars = calculate_characters(&s1); | |
println!("The length of {:?} is {:?}.",s1,len); | |
println!("The number of chars of {:?} is {:?}.",s1,chars); |
View pipe.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let input = Command::new("yes") | |
.stdout(Stdio::piped()) | |
.spawn(); | |
let _ = Command::new("gen3-client") | |
.arg("download-single") | |
.args(&["--profile=tysud456", "--guid=c254e7d9-bd10-4f8b-803f-5388de3eba9c","--filename-format=original","--rename"]) | |
.stdin(input.ok().unwrap().stdout.unwrap()) | |
.output().ok() |
View unmarshal.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var geneCSV []string | |
geneCSV = append(geneCSV, geneBackup, strconv.Itoa(geneXML.IdList[0])) | |
data = append(data, geneCSV) |
View Symbolsearchxml.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SymbolSearchXml struct { | |
XMLName xml.Name `xml:"eSearchResult"` | |
Count int `xml:"Count"` | |
RetMax int `xml:"RetMax"` | |
RetStart int `xml:"RetStart"` | |
IdList []int `xml:"IdList>Id"` | |
TranslationSet string `xml:"TranslationSet"` | |
TranslationStack TranslationStackXml `xml:"TranslationStack"` | |
QueryTranslation string `xml:"QueryTranslation"` | |
} |
View variant_id.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mapResp map[string]interface{} | |
if err := json.NewDecoder(res.Body).Decode(&mapResp); err == nil { | |
// fmt.Println(`&mapResp:`, &mapResp, "\n") | |
// fmt.Println(`mapResp["hits"]:`, mapResp["hits"]) | |
for _, value := range mapResp["hits"].(map[string]interface{}) { | |
if reflect.TypeOf(value).Kind() != reflect.Float64 { | |
for _, each := range value.([]interface{}) { |
View quick_sort.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function quick_sort(list) | |
if length(list)<2 | |
return list | |
end | |
pivot = list[1] | |
greater = [] | |
lesser = [] | |
for i = 2:length(list) | |
if pivot <= list[i] | |
append!(greater,list[i]) |
View binary_search.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k=0 | |
g=0 | |
t=0 | |
function binary_search(list,item,len_list) | |
global k | |
global g | |
global t | |
if list==[] | |
return 0 | |
end |
View maximum.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_maximum(array) | |
global maximum | |
if length(array)==0 | |
return maximum | |
end | |
if maximum<last(array) | |
maximum=last(array) | |
end | |
println(array) |
NewerOlder