Ad
Code
Diff
  • // Code is in the preload
    fn person_builder(first_name:&'static str, last_name: &'static str) -> Person {
      Person { first_name: first_name, last_name: last_name }
    }
    • // Code is in the preload
    • // Code is in the preload
    • fn person_builder(first_name:&'static str, last_name: &'static str) -> Person {
    • Person { first_name: first_name, last_name: last_name }
    • }

Some thread of random rusty stuffsz

// Code is in the preload

Updated to test that it is working with new rust changes

Code
Diff
  • pub fn powermod(n: u64, p: u64, m: u64) -> u64 {
    	if p == 0 { return 1 % m }
    	if p == 1 { return n % m }
    
    	let mut r = powermod(n, p / 2, m);
    
    	r = r * r % m;
    	if p & 1 == 1 {
    		r = r * n % m;
    	}
    	
    	r
    }
    • pub fn powermod(n: u64, p: u64, m: u64) -> u64 {
    • if p == 0 { return 1 % m }
    • if p == 1 { return n % m }
    • let mut r = powermod(n, p / 2, m);
    • r = r * r % m;
    • if p & 1 == 1 {
    • r = r * n % m;
    • }
    • r
    • }
    • #[test]
    • fn test_powermod() {
    • assert_eq!(powermod(2, 999999, 147), 50);
    • }

Passed and failing tests with imports etc

Code
Diff
  • class Person {
      String firstName;
      String lastName;
      
      Person(this.firstName,this.lastName);
      
      String get fullName => '$firstName $lastName';
    }
    • doubler(n) => n*2;
    • class Person {
    • String firstName;
    • String lastName;
    • Person(this.firstName,this.lastName);
    • String get fullName => '$firstName $lastName';
    • }

For some reason I keep using this function as a test in all the runner changes

fn doubler(n:i32) -> i32 {
  n * 2
}

Undefined is returned in this example where a semicolon is missing on the test

Provides fibonacci function, taken from Dart Pad sample in preload

Code
Diff
  • doubler(n) => n*2;
    • Stream nums = new Stream.fromIterable([1,2,3,4,5]);
    • doubler(n) => n*2;

Uses async library import in the preload

Code
Diff
  • Stream nums = new Stream.fromIterable([1,2,3,4,5]);
    
    • class Person {
    • String firstName;
    • String lastName;
    • Person(this.firstName,this.lastName);
    • }
    • Stream nums = new Stream.fromIterable([1,2,3,4,5]);

Contains random dart tests

class Person {
  String firstName;
  String lastName;
  
  Person(this.firstName,this.lastName);
}

Test of the codewars array test case

var array = ['codewars'];