Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Run v fmt -w #172

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions exercises/practice/grade-school/grade-school.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ module main
// To make it easy to search, that has been replaced with <TYPE>. Good luck! :)

fn add_student(roster <TYPE>, name string, grade int) <TYPE> {

}

fn get_students_in_grade(roster <TYPE>, grade int) []string {

}

fn get_all_students(roster <TYPE>) []string {

}

// This is a helper function that should return an
// This is a helper function that should return an
// empty roster (type of your choosing)
fn create_new_roster() <TYPE> {
return <TYPE>
}
}
4 changes: 1 addition & 3 deletions exercises/practice/grains/grains.v
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module main

fn grains_on_square(square int) !u64 {

}

fn total_grains_on_board() u64 {

}
}
14 changes: 7 additions & 7 deletions exercises/practice/grains/run_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ fn test_grains_sq_64() {

fn test_error_0() {
if res := grains_on_square(0) {
assert false, "invalid square number should return error"
assert false, 'invalid square number should return error'
} else {
assert err.msg() == "square must be between 1 and 64"
assert err.msg() == 'square must be between 1 and 64'
}
}

fn test_error_1() {
if res := grains_on_square(-1) {
assert false, "invalid square number should return error"
assert false, 'invalid square number should return error'
} else {
assert err.msg() == "square must be between 1 and 64"
assert err.msg() == 'square must be between 1 and 64'
}
}

fn test_error_65() {
if res := grains_on_square(65) {
assert false, "invalid square number should return error"
assert false, 'invalid square number should return error'
} else {
assert err.msg() == "square must be between 1 and 64"
assert err.msg() == 'square must be between 1 and 64'
}
}

fn test_total_grains() {
assert total_grains_on_board() == 18446744073709551615
}
}
4 changes: 2 additions & 2 deletions exercises/practice/hello-world/hello-world.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module main

fn hello() string {
return "Goodbye, Mars!"
}
return 'Goodbye, Mars!'
}
6 changes: 3 additions & 3 deletions exercises/practice/hello-world/run_test.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module main

fn test_hello(){
assert hello() == "Hello, World!"
}
fn test_hello() {
assert hello() == 'Hello, World!'
}
3 changes: 1 addition & 2 deletions exercises/practice/leap/leap.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ module main

// is_leap_year returns true if the given year is a leap year in the Gregorian calendar
fn is_leap_year(year int) bool {

}
}
4 changes: 2 additions & 2 deletions exercises/practice/leap/run_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn test_divisible_by_4_and_5() {
assert is_leap_year(1960)
}

fn test_divisible_by_100_not_by_400(){
fn test_divisible_by_100_not_by_400() {
assert !is_leap_year(2100)
}

Expand All @@ -34,4 +34,4 @@ fn test_divisible_by_100_not_by_125() {

fn test_divisible_by_200_not_by_400() {
assert !is_leap_year(1800)
}
}
1 change: 0 additions & 1 deletion exercises/practice/nth-prime/nth-prime.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module main

fn nth_prime(n int) !int {

}
1 change: 0 additions & 1 deletion exercises/practice/nucleotide-count/nucleotide-count.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module main

fn count_nucleotides(strand string) !map[string]int {

}
3 changes: 1 addition & 2 deletions exercises/practice/pangram/pangram.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module main

fn is_pangram(phrase string) bool {

}
}
24 changes: 12 additions & 12 deletions exercises/practice/pangram/run_test.v
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
module main

fn test_empty_string() {
assert !is_pangram("")
assert !is_pangram('')
}

fn test_perfect_lower_case() {
assert is_pangram("abcdefghijklmnopqrstuvwxyz")
assert is_pangram('abcdefghijklmnopqrstuvwxyz')
}

fn test_perfect_only_case() {
assert is_pangram("the quick brown fox jumps over the lazy dog")
assert is_pangram('the quick brown fox jumps over the lazy dog')
}

fn test_missing_letter_x() {
assert !is_pangram("a quick movement of the enemy will jeopardize five gunboats")
assert !is_pangram('a quick movement of the enemy will jeopardize five gunboats')
}

fn test_missing_letter_h() {
assert !is_pangram("five boxing wizards jump quickly at it")
assert !is_pangram('five boxing wizards jump quickly at it')
}

fn test_with_underscores() {
assert is_pangram("the_quick_brown_fox_jumps_over_the_lazy_dog")
assert is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog')
}

fn test_with_numbers() {
assert is_pangram("the 1 quick brown fox jumps over the 2 lazy dogs")
assert is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs')
}

fn test_letters_replaced_by_numbers() {
assert !is_pangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")
assert !is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog')
}

fn test_mixed_case_and_punctuation() {
assert is_pangram("\"Five quacking Zephyrs jolt my wax bed.\"")
assert is_pangram('"Five quacking Zephyrs jolt my wax bed."')
}

fn test_case_insensitive() {
assert !is_pangram("the quick brown fox jumps over with lazy FX")
assert !is_pangram('the quick brown fox jumps over with lazy FX')
}

fn test_a_m_lower_and_upper() {
assert !is_pangram("abcdefghijklm ABCDEFGHIJKLM")
}
assert !is_pangram('abcdefghijklm ABCDEFGHIJKLM')
}
3 changes: 1 addition & 2 deletions exercises/practice/reverse-string/reverse-string.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ module main

// reverse_string returns a given string in reverse order
fn reverse_string(str string) string {

}
}
12 changes: 6 additions & 6 deletions exercises/practice/reverse-string/run_test.v
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module main

fn test_empty() {
assert reverse_string("") == ""
assert reverse_string('') == ''
}

fn test_word() {
assert reverse_string("robot") == "tobor"
assert reverse_string('robot') == 'tobor'
}

fn test_capitalized_word() {
assert reverse_string("Ramen") == "nemaR"
assert reverse_string('Ramen') == 'nemaR'
}

fn test_sentence_with_punctuation() {
assert reverse_string("I'm hungry!") == "!yrgnuh m'I"
}

fn test_palindrome() {
assert reverse_string("racecar") == "racecar"
assert reverse_string('racecar') == 'racecar'
}

fn test_even_length_word() {
assert reverse_string("drawer") == "reward"
}
assert reverse_string('drawer') == 'reward'
}
24 changes: 12 additions & 12 deletions exercises/practice/rna-transcription/run_test.v
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module main

fn test_empty_rna(){
assert to_rna('')==''
fn test_empty_rna() {
assert to_rna('') == ''
}

fn test_cytosine_to_guanine(){
assert to_rna('C')=='G'
fn test_cytosine_to_guanine() {
assert to_rna('C') == 'G'
}

fn test_guanine_to_cytosine(){
assert to_rna('G')=='C'
fn test_guanine_to_cytosine() {
assert to_rna('G') == 'C'
}

fn test_thymine_to_adenine(){
assert to_rna('T')=='A'
fn test_thymine_to_adenine() {
assert to_rna('T') == 'A'
}

fn test_adenine_to_uracial(){
assert to_rna('A')=='U'
fn test_adenine_to_uracial() {
assert to_rna('A') == 'U'
}

fn test_rna_complement(){
fn test_rna_complement() {
assert to_rna('ACGTGGTCTTAA') == 'UGCACCAGAAUU'
}
}
3 changes: 1 addition & 2 deletions exercises/practice/robot-name/robot-name.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import rand

// define the Robot struct here
struct Robot {

}

// we need a place to store all these robots!
Expand All @@ -18,4 +17,4 @@ fn create_robot(mut robots <TYPE>) Robot {
}

fn (mut r Robot) reset(mut robots <TYPE>) {
}
}
10 changes: 1 addition & 9 deletions exercises/practice/simple-linked-list/simple-linked-list.v
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
module main

struct LinkedList {
// define your data structure here
mut:
// define your data structure here
len int // maintain the number of elements in the list in this field
}

fn new() LinkedList {

}

fn from_array(array []int) LinkedList {

}

fn (list LinkedList) is_empty() bool {

}

fn (mut list LinkedList) push(data int) {

}

fn (mut list LinkedList) pop() ?int {

}

fn (list LinkedList) peek() ?int {

}

fn (list LinkedList) to_array() []int {

}

fn (list LinkedList) reverse() LinkedList {

}
2 changes: 1 addition & 1 deletion exercises/practice/space-age/space-age.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module main

fn age(seconds f64, planet string) !f64 {
// age should return an error if the planet is not one of the 8 listed
}
}
3 changes: 1 addition & 2 deletions exercises/practice/triangle/run_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ fn test_true_eq_float_triangle() {
assert is_equilateral(0.5, 0.5, 0.5)
}


// ISOSCELES TRIANGLES
fn test_true_iso_last_two_equal() {
assert is_isosceles(3, 4, 4)
Expand Down Expand Up @@ -82,4 +81,4 @@ fn test_false_sca_triangle_inequality() {

fn test_true_sca_float_sides() {
assert is_scalene(0.5, 0.4, 0.6)
}
}
5 changes: 1 addition & 4 deletions exercises/practice/triangle/triangle.v
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module main

fn is_isosceles(a f64, b f64, c f64) bool {

}

fn is_equilateral(a f64, b f64, c f64) bool {

}

fn is_scalene(a f64, b f64, c f64) bool {

}
}
Loading