From f2a4bef3ba49a9cadc8c789904f6231e54984687 Mon Sep 17 00:00:00 2001 From: Victor Payno Date: Wed, 25 Oct 2023 22:57:29 -0700 Subject: [PATCH] ruby/protein-translation: 1st iteration --- ruby/README.md | 1 + ruby/protein-translation/README.md | 7 +- .../coverage/.last_run.json | 5 + .../coverage/.resultset.json | 75 +++ .../coverage/.resultset.json.lock | 0 .../protein-translation/coverage/coverage.xml | 42 ++ .../protein_translation.rb | 69 ++- .../protein_translation_test.rb | 174 ++++--- ruby/protein-translation/run-tests-ruby.txt | 440 ++++++++++++++++++ 9 files changed, 731 insertions(+), 82 deletions(-) create mode 100644 ruby/protein-translation/coverage/.last_run.json create mode 100644 ruby/protein-translation/coverage/.resultset.json create mode 100644 ruby/protein-translation/coverage/.resultset.json.lock create mode 100644 ruby/protein-translation/coverage/coverage.xml create mode 100644 ruby/protein-translation/run-tests-ruby.txt diff --git a/ruby/README.md b/ruby/README.md index cbbf5743..5aa00e3a 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -63,3 +63,4 @@ - [microwave](./microwave/README.md) - [bob](./bob/README.md) - [isbn-verifier](./isbn-verifier/README.md) +- [protein-translation](./protein-translation/README.md) diff --git a/ruby/protein-translation/README.md b/ruby/protein-translation/README.md index 51a922d3..7729c429 100644 --- a/ruby/protein-translation/README.md +++ b/ruby/protein-translation/README.md @@ -71,4 +71,9 @@ Learn more about [protein translation on Wikipedia][protein-translation]. ### Based on -Tyler Long \ No newline at end of file +Tyler Long + +### My Solution + +- [my solution](./protein_translation.rb) +- [run-tests](./run-tests-ruby.txt) diff --git a/ruby/protein-translation/coverage/.last_run.json b/ruby/protein-translation/coverage/.last_run.json new file mode 100644 index 00000000..52d2bf29 --- /dev/null +++ b/ruby/protein-translation/coverage/.last_run.json @@ -0,0 +1,5 @@ +{ + "result": { + "line": 100.0 + } +} diff --git a/ruby/protein-translation/coverage/.resultset.json b/ruby/protein-translation/coverage/.resultset.json new file mode 100644 index 00000000..299b619f --- /dev/null +++ b/ruby/protein-translation/coverage/.resultset.json @@ -0,0 +1,75 @@ +{ + "test:exercism": { + "coverage": { + "/home/vpayno/git_vpayno/exercism-workspace/ruby/protein-translation/protein_translation.rb": { + "lines": [ + null, + null, + null, + null, + 1, + 1, + null, + 1, + null, + 32, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 32, + null, + 30, + null, + null, + 1, + 30, + null, + 29, + 29, + 29, + 42, + null, + 42, + 9, + 9, + null, + null, + 33, + null, + null, + 29, + null, + 60, + null, + null, + null, + null, + 1, + 1, + null, + 1, + 3, + 3, + null, + null + ] + } + }, + "timestamp": 1698299820 + } +} diff --git a/ruby/protein-translation/coverage/.resultset.json.lock b/ruby/protein-translation/coverage/.resultset.json.lock new file mode 100644 index 00000000..e69de29b diff --git a/ruby/protein-translation/coverage/coverage.xml b/ruby/protein-translation/coverage/coverage.xml new file mode 100644 index 00000000..3b14fb16 --- /dev/null +++ b/ruby/protein-translation/coverage/coverage.xml @@ -0,0 +1,42 @@ + + + + + + /home/vpayno/git_vpayno/exercism-workspace/ruby/protein-translation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruby/protein-translation/protein_translation.rb b/ruby/protein-translation/protein_translation.rb index 4f4e5d24..f04927a9 100644 --- a/ruby/protein-translation/protein_translation.rb +++ b/ruby/protein-translation/protein_translation.rb @@ -1,7 +1,64 @@ -=begin -Write your code for the 'Protein Translation' exercise in this file. Make the tests in -`protein_translation_test.rb` pass. +# frozen_string_literal: false -To get started with TDD, see the `README.md` file in your -`ruby/protein-translation` directory. -=end +# https://exercism.org/tracks/ruby/exercises/protein-translation +# Protein Translation exercise +module Translation + CODON_LENGTH = 3 + + def self.to_protein(codon) + codon2protein = { + 'AUG' => 'Methionine', + 'UUU' => 'Phenylalanine', + 'UUC' => 'Phenylalanine', + 'UUA' => 'Leucine', + 'UUG' => 'Leucine', + 'UCU' => 'Serine', + 'UCC' => 'Serine', + 'UCA' => 'Serine', + 'UCG' => 'Serine', + 'UAU' => 'Tyrosine', + 'UAC' => 'Tyrosine', + 'UGU' => 'Cysteine', + 'UGC' => 'Cysteine', + 'UGG' => 'Tryptophan', + 'UAA' => 'STOP', + 'UAG' => 'STOP', + 'UGA' => 'STOP' + } + + raise InvalidCodonError, 'invalid codon' unless codon2protein.key?(codon) + + codon2protein[codon] + end + + def self.of_rna(rna_sequence) + return [] if rna_sequence.empty? + + has_stop = false + codons = [] + rna_sequence.scan(/([A-Z]{3})/) do |match| + codon = match[0] + + if %w[UAA UAG UGA].include?(codon) + has_stop = true + break + end + + codons.push(codon) + end + + raise InvalidCodonError, 'invalid codon' if !has_stop && rna_sequence.length.modulo(CODON_LENGTH).positive? + + codons.map { |codon| to_protein(codon) } + end +end + +# InvalidCodonError exception +class InvalidCodonError < StandardError + attr_reader :data + + def initialize(data) + super + @data = data + end +end diff --git a/ruby/protein-translation/protein_translation_test.rb b/ruby/protein-translation/protein_translation_test.rb index 9dfaadc3..acc80c34 100644 --- a/ruby/protein-translation/protein_translation_test.rb +++ b/ruby/protein-translation/protein_translation_test.rb @@ -1,216 +1,240 @@ +# frozen_string_literal: false + +# https://github.com/simplecov-ruby/simplecov +require 'simplecov' + +# https://about.codecov.io/blog/getting-started-with-code-coverage-for-ruby/ +require 'simplecov-cobertura' +SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter + +# line coverage +SimpleCov.start if ENV['COVERAGE'] != 'branch' + +# branch coverage +if ENV['COVERAGE'] == 'branch' + SimpleCov.start do + enable_coverage :branch + primary_coverage :branch + end +end + +# name the test file/group +SimpleCov.command_name 'test:exercism' + +# original exercism tests require 'minitest/autorun' require_relative 'protein_translation' class ProteinTranslationTest < Minitest::Test def test_empty_rna_sequence_results_in_no_proteins # skip - strand = "" + strand = '' expected = [] assert_equal expected, Translation.of_rna(strand) end def test_methionine_rna_sequence - skip - strand = "AUG" - expected = ["Methionine"] + # skip + strand = 'AUG' + expected = ['Methionine'] assert_equal expected, Translation.of_rna(strand) end def test_phenylalanine_rna_sequence_1 - skip - strand = "UUU" - expected = ["Phenylalanine"] + # skip + strand = 'UUU' + expected = ['Phenylalanine'] assert_equal expected, Translation.of_rna(strand) end def test_phenylalanine_rna_sequence_2 - skip - strand = "UUC" - expected = ["Phenylalanine"] + # skip + strand = 'UUC' + expected = ['Phenylalanine'] assert_equal expected, Translation.of_rna(strand) end def test_leucine_rna_sequence_1 - skip - strand = "UUA" - expected = ["Leucine"] + # skip + strand = 'UUA' + expected = ['Leucine'] assert_equal expected, Translation.of_rna(strand) end def test_leucine_rna_sequence_2 - skip - strand = "UUG" - expected = ["Leucine"] + # skip + strand = 'UUG' + expected = ['Leucine'] assert_equal expected, Translation.of_rna(strand) end def test_serine_rna_sequence_1 - skip - strand = "UCU" - expected = ["Serine"] + # skip + strand = 'UCU' + expected = ['Serine'] assert_equal expected, Translation.of_rna(strand) end def test_serine_rna_sequence_2 - skip - strand = "UCC" - expected = ["Serine"] + # skip + strand = 'UCC' + expected = ['Serine'] assert_equal expected, Translation.of_rna(strand) end def test_serine_rna_sequence_3 - skip - strand = "UCA" - expected = ["Serine"] + # skip + strand = 'UCA' + expected = ['Serine'] assert_equal expected, Translation.of_rna(strand) end def test_serine_rna_sequence_4 - skip - strand = "UCG" - expected = ["Serine"] + # skip + strand = 'UCG' + expected = ['Serine'] assert_equal expected, Translation.of_rna(strand) end def test_tyrosine_rna_sequence_1 - skip - strand = "UAU" - expected = ["Tyrosine"] + # skip + strand = 'UAU' + expected = ['Tyrosine'] assert_equal expected, Translation.of_rna(strand) end def test_tyrosine_rna_sequence_2 - skip - strand = "UAC" - expected = ["Tyrosine"] + # skip + strand = 'UAC' + expected = ['Tyrosine'] assert_equal expected, Translation.of_rna(strand) end def test_cysteine_rna_sequence_1 - skip - strand = "UGU" - expected = ["Cysteine"] + # skip + strand = 'UGU' + expected = ['Cysteine'] assert_equal expected, Translation.of_rna(strand) end def test_cysteine_rna_sequence_2 - skip - strand = "UGC" - expected = ["Cysteine"] + # skip + strand = 'UGC' + expected = ['Cysteine'] assert_equal expected, Translation.of_rna(strand) end def test_tryptophan_rna_sequence - skip - strand = "UGG" - expected = ["Tryptophan"] + # skip + strand = 'UGG' + expected = ['Tryptophan'] assert_equal expected, Translation.of_rna(strand) end def test_stop_codon_rna_sequence_1 - skip - strand = "UAA" + # skip + strand = 'UAA' expected = [] assert_equal expected, Translation.of_rna(strand) end def test_stop_codon_rna_sequence_2 - skip - strand = "UAG" + # skip + strand = 'UAG' expected = [] assert_equal expected, Translation.of_rna(strand) end def test_stop_codon_rna_sequence_3 - skip - strand = "UGA" + # skip + strand = 'UGA' expected = [] assert_equal expected, Translation.of_rna(strand) end def test_sequence_of_two_protein_codons_translates_into_proteins - skip - strand = "UUUUUU" + # skip + strand = 'UUUUUU' expected = %w[Phenylalanine Phenylalanine] assert_equal expected, Translation.of_rna(strand) end def test_sequence_of_two_different_protein_codons_translates_into_proteins - skip - strand = "UUAUUG" + # skip + strand = 'UUAUUG' expected = %w[Leucine Leucine] assert_equal expected, Translation.of_rna(strand) end def test_translate_rna_strand_into_correct_protein_list - skip - strand = "AUGUUUUGG" + # skip + strand = 'AUGUUUUGG' expected = %w[Methionine Phenylalanine Tryptophan] assert_equal expected, Translation.of_rna(strand) end def test_translation_stops_if_stop_codon_at_beginning_of_sequence - skip - strand = "UAGUGG" + # skip + strand = 'UAGUGG' expected = [] assert_equal expected, Translation.of_rna(strand) end def test_translation_stops_if_stop_codon_at_end_of_two_codon_sequence - skip - strand = "UGGUAG" - expected = ["Tryptophan"] + # skip + strand = 'UGGUAG' + expected = ['Tryptophan'] assert_equal expected, Translation.of_rna(strand) end def test_translation_stops_if_stop_codon_at_end_of_three_codon_sequence - skip - strand = "AUGUUUUAA" + # skip + strand = 'AUGUUUUAA' expected = %w[Methionine Phenylalanine] assert_equal expected, Translation.of_rna(strand) end def test_translation_stops_if_stop_codon_in_middle_of_three_codon_sequence - skip - strand = "UGGUAGUGG" - expected = ["Tryptophan"] + # skip + strand = 'UGGUAGUGG' + expected = ['Tryptophan'] assert_equal expected, Translation.of_rna(strand) end def test_translation_stops_if_stop_codon_in_middle_of_six_codon_sequence - skip - strand = "UGGUGUUAUUAAUGGUUU" + # skip + strand = 'UGGUGUUAUUAAUGGUUU' expected = %w[Tryptophan Cysteine Tyrosine] assert_equal expected, Translation.of_rna(strand) end def test_non_existing_codon_cant_translate - skip - strand = "AAA" + # skip + strand = 'AAA' assert_raises(InvalidCodonError) do Translation.of_rna(strand) end end def test_unknown_amino_acids_not_part_of_a_codon_cant_translate - skip - strand = "XYZ" + # skip + strand = 'XYZ' assert_raises(InvalidCodonError) do Translation.of_rna(strand) end end def test_incomplete_rna_sequence_cant_translate - skip - strand = "AUGU" + # skip + strand = 'AUGU' assert_raises(InvalidCodonError) do Translation.of_rna(strand) end end def test_incomplete_rna_sequence_can_translate_if_valid_until_a_stop_codon - skip - strand = "UUCUUCUAAUGGU" + # skip + strand = 'UUCUUCUAAUGGU' expected = %w[Phenylalanine Phenylalanine] assert_equal expected, Translation.of_rna(strand) end diff --git a/ruby/protein-translation/run-tests-ruby.txt b/ruby/protein-translation/run-tests-ruby.txt new file mode 100644 index 00000000..6c2b5829 --- /dev/null +++ b/ruby/protein-translation/run-tests-ruby.txt @@ -0,0 +1,440 @@ +Running automated test file(s): + + +=============================================================================== + +Running: ../../.github/citools/ruby/ruby-lint-rubycritic + +Running RubyCritic + +Ruby version: + + ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux] + rbenv 1.2.0-11-ge4f61e6 + + + ============================================================================== + +Running: rubycritic --path .rubycritic --format console --no-browser . + +running flay smells + +running flog smells +.. +running reek smells +.. +running complexity +.. +running attributes +.. +running churn +.. +running simple_cov +.. +/home/vpayno/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rubycritic-4.6.1/lib/rubycritic/generators/text/list.rb:13: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. +/home/vpayno/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rubycritic-4.6.1/lib/rubycritic/generators/text/list.rb:13: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. +Translation: + Rating: A + Churn: 0 + Complexity: 22.05 + Duplication: 0 + Smells: 1 + * (TooManyStatements) Translation#self.of_rna has approx 11 statements + - protein_translation.rb:34 + +ProteinTranslationTest: + Rating: B + Churn: 0 + Complexity: 96.24 + Duplication: 0 + Smells: 17 + * (IrresponsibleModule) ProteinTranslationTest has no descriptive comment + - protein_translation_test.rb:28 + * (TooManyMethods) ProteinTranslationTest has at least 30 methods + - protein_translation_test.rb:28 + * (UncommunicativeMethodName) ProteinTranslationTest#test_cysteine_rna_sequence_1 has the name 'test_cysteine_rna_sequence_1' + - protein_translation_test.rb:113 + * (UncommunicativeMethodName) ProteinTranslationTest#test_cysteine_rna_sequence_2 has the name 'test_cysteine_rna_sequence_2' + - protein_translation_test.rb:120 + * (UncommunicativeMethodName) ProteinTranslationTest#test_leucine_rna_sequence_1 has the name 'test_leucine_rna_sequence_1' + - protein_translation_test.rb:57 + * (UncommunicativeMethodName) ProteinTranslationTest#test_leucine_rna_sequence_2 has the name 'test_leucine_rna_sequence_2' + - protein_translation_test.rb:64 + * (UncommunicativeMethodName) ProteinTranslationTest#test_phenylalanine_rna_sequence_1 has the name 'test_phenylalanine_rna_sequence_1' + - protein_translation_test.rb:43 + * (UncommunicativeMethodName) ProteinTranslationTest#test_phenylalanine_rna_sequence_2 has the name 'test_phenylalanine_rna_sequence_2' + - protein_translation_test.rb:50 + * (UncommunicativeMethodName) ProteinTranslationTest#test_serine_rna_sequence_1 has the name 'test_serine_rna_sequence_1' + - protein_translation_test.rb:71 + * (UncommunicativeMethodName) ProteinTranslationTest#test_serine_rna_sequence_2 has the name 'test_serine_rna_sequence_2' + - protein_translation_test.rb:78 + * (UncommunicativeMethodName) ProteinTranslationTest#test_serine_rna_sequence_3 has the name 'test_serine_rna_sequence_3' + - protein_translation_test.rb:85 + * (UncommunicativeMethodName) ProteinTranslationTest#test_serine_rna_sequence_4 has the name 'test_serine_rna_sequence_4' + - protein_translation_test.rb:92 + * (UncommunicativeMethodName) ProteinTranslationTest#test_stop_codon_rna_sequence_1 has the name 'test_stop_codon_rna_sequence_1' + - protein_translation_test.rb:134 + * (UncommunicativeMethodName) ProteinTranslationTest#test_stop_codon_rna_sequence_2 has the name 'test_stop_codon_rna_sequence_2' + - protein_translation_test.rb:141 + * (UncommunicativeMethodName) ProteinTranslationTest#test_stop_codon_rna_sequence_3 has the name 'test_stop_codon_rna_sequence_3' + - protein_translation_test.rb:148 + * (UncommunicativeMethodName) ProteinTranslationTest#test_tyrosine_rna_sequence_1 has the name 'test_tyrosine_rna_sequence_1' + - protein_translation_test.rb:99 + * (UncommunicativeMethodName) ProteinTranslationTest#test_tyrosine_rna_sequence_2 has the name 'test_tyrosine_rna_sequence_2' + - protein_translation_test.rb:106 +Score: 85.21 + +real 0m0.652s +user 0m0.551s +sys 0m0.098s + + + ============================================================================== + +Exit code: 0 + +real 0m0.733s +user 0m0.582s +sys 0m0.153s + +real 0m0.736s +user 0m0.583s +sys 0m0.155s + +=============================================================================== + +Running: ../../.github/citools/ruby/ruby-lint-formatter + +Running Ruby Formatter + +Ruby version: + + ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux] + rbenv 1.2.0-11-ge4f61e6 + + + ============================================================================== + +Running: rubocop -a . + +Inspecting 2 files +CC + +Offenses: + +protein_translation.rb:8:3: C: Metrics/MethodLength: Method has too many lines. [21/10] + def self.to_protein(codon) ... + ^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation.rb:34:3: C: Metrics/MethodLength: Method has too many lines. [13/10] + def self.of_rna(rna_sequence) ... + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:28:1: C: Metrics/ClassLength: Class has too many lines. [153/100] +class ProteinTranslationTest < Minitest::Test ... +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:28:1: C: Style/Documentation: Missing top-level documentation comment for class ProteinTranslationTest. +class ProteinTranslationTest < Minitest::Test +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:31:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "" + ^^ +protein_translation_test.rb:38:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "AUG" + ^^^^^ +protein_translation_test.rb:39:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Methionine"] + ^^^^^^^^^^^^ +protein_translation_test.rb:43:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_phenylalanine_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:45:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUU" + ^^^^^ +protein_translation_test.rb:46:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Phenylalanine"] + ^^^^^^^^^^^^^^^ +protein_translation_test.rb:50:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_phenylalanine_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:52:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUC" + ^^^^^ +protein_translation_test.rb:53:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Phenylalanine"] + ^^^^^^^^^^^^^^^ +protein_translation_test.rb:57:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_leucine_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:59:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUA" + ^^^^^ +protein_translation_test.rb:60:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Leucine"] + ^^^^^^^^^ +protein_translation_test.rb:64:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_leucine_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:66:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUG" + ^^^^^ +protein_translation_test.rb:67:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Leucine"] + ^^^^^^^^^ +protein_translation_test.rb:71:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_serine_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:73:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UCU" + ^^^^^ +protein_translation_test.rb:74:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Serine"] + ^^^^^^^^ +protein_translation_test.rb:78:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_serine_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:80:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UCC" + ^^^^^ +protein_translation_test.rb:81:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Serine"] + ^^^^^^^^ +protein_translation_test.rb:85:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_serine_rna_sequence_3 + ^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:87:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UCA" + ^^^^^ +protein_translation_test.rb:88:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Serine"] + ^^^^^^^^ +protein_translation_test.rb:92:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_serine_rna_sequence_4 + ^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:94:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UCG" + ^^^^^ +protein_translation_test.rb:95:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Serine"] + ^^^^^^^^ +protein_translation_test.rb:99:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_tyrosine_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:101:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UAU" + ^^^^^ +protein_translation_test.rb:102:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Tyrosine"] + ^^^^^^^^^^ +protein_translation_test.rb:106:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_tyrosine_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:108:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UAC" + ^^^^^ +protein_translation_test.rb:109:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Tyrosine"] + ^^^^^^^^^^ +protein_translation_test.rb:113:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_cysteine_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:115:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGU" + ^^^^^ +protein_translation_test.rb:116:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Cysteine"] + ^^^^^^^^^^ +protein_translation_test.rb:120:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_cysteine_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:122:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGC" + ^^^^^ +protein_translation_test.rb:123:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Cysteine"] + ^^^^^^^^^^ +protein_translation_test.rb:129:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGG" + ^^^^^ +protein_translation_test.rb:130:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Tryptophan"] + ^^^^^^^^^^^^ +protein_translation_test.rb:134:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_stop_codon_rna_sequence_1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:136:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UAA" + ^^^^^ +protein_translation_test.rb:141:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_stop_codon_rna_sequence_2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:143:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UAG" + ^^^^^ +protein_translation_test.rb:148:7: C: Naming/VariableNumber: Use normalcase for method name numbers. + def test_stop_codon_rna_sequence_3 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:150:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGA" + ^^^^^ +protein_translation_test.rb:157:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUUUUU" + ^^^^^^^^ +protein_translation_test.rb:164:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUAUUG" + ^^^^^^^^ +protein_translation_test.rb:171:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "AUGUUUUGG" + ^^^^^^^^^^^ +protein_translation_test.rb:178:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UAGUGG" + ^^^^^^^^ +protein_translation_test.rb:185:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGGUAG" + ^^^^^^^^ +protein_translation_test.rb:186:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Tryptophan"] + ^^^^^^^^^^^^ +protein_translation_test.rb:192:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "AUGUUUUAA" + ^^^^^^^^^^^ +protein_translation_test.rb:199:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGGUAGUGG" + ^^^^^^^^^^^ +protein_translation_test.rb:200:17: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + expected = ["Tryptophan"] + ^^^^^^^^^^^^ +protein_translation_test.rb:206:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UGGUGUUAUUAAUGGUUU" + ^^^^^^^^^^^^^^^^^^^^ +protein_translation_test.rb:213:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "AAA" + ^^^^^ +protein_translation_test.rb:221:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "XYZ" + ^^^^^ +protein_translation_test.rb:229:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "AUGU" + ^^^^^^ +protein_translation_test.rb:237:14: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. + strand = "UUCUUCUAAUGGU" + ^^^^^^^^^^^^^^^ + +2 files inspected, 65 offenses detected, 46 offenses corrected + +real 0m1.080s +user 0m0.949s +sys 0m0.230s + + + ============================================================================== + +Exit code: -1 + +real 0m1.151s +user 0m0.983s +sys 0m0.271s + +real 0m1.152s +user 0m0.984s +sys 0m0.272s + +=============================================================================== + +Running: ../../.github/citools/ruby/ruby-test-with-coverage + +Running Ruby Tests With Coverage + +Ruby version: + + ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux] + rbenv 1.2.0-11-ge4f61e6 + + + ============================================================================== + +Running: rm -rf ./coverage + + +real 0m0.001s +user 0m0.001s +sys 0m0.000s + + + ============================================================================== + +Running: ruby ./protein_translation_test.rb -v + +Run options: -v --seed 13077 + +# Running: + +ProteinTranslationTest#test_serine_rna_sequence_3 = 0.00 s = . +ProteinTranslationTest#test_stop_codon_rna_sequence_3 = 0.00 s = . +ProteinTranslationTest#test_translation_stops_if_stop_codon_in_middle_of_three_codon_sequence = 0.00 s = . +ProteinTranslationTest#test_serine_rna_sequence_4 = 0.00 s = . +ProteinTranslationTest#test_translation_stops_if_stop_codon_at_end_of_three_codon_sequence = 0.00 s = . +ProteinTranslationTest#test_leucine_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_tyrosine_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_cysteine_rna_sequence_2 = 0.00 s = . +ProteinTranslationTest#test_methionine_rna_sequence = 0.00 s = . +ProteinTranslationTest#test_leucine_rna_sequence_2 = 0.00 s = . +ProteinTranslationTest#test_serine_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_empty_rna_sequence_results_in_no_proteins = 0.00 s = . +ProteinTranslationTest#test_tryptophan_rna_sequence = 0.00 s = . +ProteinTranslationTest#test_phenylalanine_rna_sequence_2 = 0.00 s = . +ProteinTranslationTest#test_sequence_of_two_different_protein_codons_translates_into_proteins = 0.00 s = . +ProteinTranslationTest#test_translation_stops_if_stop_codon_at_end_of_two_codon_sequence = 0.00 s = . +ProteinTranslationTest#test_translation_stops_if_stop_codon_at_beginning_of_sequence = 0.00 s = . +ProteinTranslationTest#test_incomplete_rna_sequence_can_translate_if_valid_until_a_stop_codon = 0.00 s = . +ProteinTranslationTest#test_non_existing_codon_cant_translate = 0.00 s = . +ProteinTranslationTest#test_stop_codon_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_sequence_of_two_protein_codons_translates_into_proteins = 0.00 s = . +ProteinTranslationTest#test_serine_rna_sequence_2 = 0.00 s = . +ProteinTranslationTest#test_stop_codon_rna_sequence_2 = 0.00 s = . +ProteinTranslationTest#test_translation_stops_if_stop_codon_in_middle_of_six_codon_sequence = 0.00 s = . +ProteinTranslationTest#test_translate_rna_strand_into_correct_protein_list = 0.00 s = . +ProteinTranslationTest#test_incomplete_rna_sequence_cant_translate = 0.00 s = . +ProteinTranslationTest#test_unknown_amino_acids_not_part_of_a_codon_cant_translate = 0.00 s = . +ProteinTranslationTest#test_cysteine_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_phenylalanine_rna_sequence_1 = 0.00 s = . +ProteinTranslationTest#test_tyrosine_rna_sequence_2 = 0.00 s = . + +Finished in 0.002871s, 10451.0863 runs/s, 10451.0863 assertions/s. + +30 runs, 30 assertions, 0 failures, 0 errors, 0 skips +Coverage report generated for test:exercism to /home/vpayno/git_vpayno/exercism-workspace/ruby/protein-translation/coverage/coverage.xml. 23 / 23 LOC (100.00%) covered + +real 0m0.186s +user 0m0.135s +sys 0m0.049s + + + ============================================================================== + +Coverage: 100.0% + + ============================================================================== + +Exit code: 0 + +real 0m0.267s +user 0m0.171s +sys 0m0.098s + +real 0m0.269s +user 0m0.173s +sys 0m0.099s + +=============================================================================== + +Running: misspell . + +real 0m0.025s +user 0m0.023s +sys 0m0.016s + +=============================================================================== + +/home/vpayno/git_vpayno/exercism-workspace/ruby + +=============================================================================== +