diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 79ba035..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "bundler" - directory: "/" - schedule: - interval: "monthly" - reviewers: ["githubtraining/implementation-engineers"] diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 45471e2..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -vendor/ -_site/ -.sass-cache/ -.jekyll-cache/ -.jekyll-metadata -.bundle/ diff --git a/Gemfile b/Gemfile index 33d9d3b..4da2586 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ source "https://rubygems.org" -gem 'github-pages', group: :jekyll_plugins +gem "github-pages" +gem "minitest" +gem "test-unit" diff --git a/Gemfile.lock b/Gemfile.lock index 2441316..91728f4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,274 +1,204 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.1.3.2) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - base64 (0.2.0) - bigdecimal (3.1.6) + activesupport (4.2.8) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) colorator (1.1.0) - commonmarker (0.23.10) - concurrent-ruby (1.2.3) - connection_pool (2.4.1) - dnsruby (1.70.0) - simpleidn (~> 0.2.1) - drb (2.2.1) - em-websocket (0.5.3) - eventmachine (>= 0.12.9) - http_parser.rb (~> 0) - ethon (0.16.0) - ffi (>= 1.15.0) - eventmachine (1.2.7) - execjs (2.9.1) - faraday (2.9.0) - faraday-net_http (>= 2.0, < 3.2) - faraday-net_http (3.1.0) - net-http - ffi (1.16.3) + ethon (0.10.1) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.12.1) + multipart-post (>= 1.2, < 3) + ffi (1.9.18) forwardable-extended (2.6.0) - gemoji (4.1.0) - github-pages (231) - github-pages-health-check (= 1.18.2) - jekyll (= 3.9.5) - jekyll-avatar (= 0.8.0) - jekyll-coffeescript (= 1.2.2) - jekyll-commonmark-ghpages (= 0.4.0) - jekyll-default-layout (= 0.1.5) - jekyll-feed (= 0.17.0) - jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.16.1) - jekyll-include-cache (= 0.2.1) - jekyll-mentions (= 1.6.0) - jekyll-optional-front-matter (= 0.3.2) + gemoji (3.0.0) + github-pages (139) + activesupport (= 4.2.8) + github-pages-health-check (= 1.3.3) + jekyll (= 3.4.3) + jekyll-avatar (= 0.4.2) + jekyll-coffeescript (= 1.0.1) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.9.2) + jekyll-gist (= 1.4.0) + jekyll-github-metadata (= 2.3.1) + jekyll-mentions (= 1.2.0) + jekyll-optional-front-matter (= 0.1.2) jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.3.0) - jekyll-redirect-from (= 0.16.0) - jekyll-relative-links (= 0.6.1) - jekyll-remote-theme (= 0.4.3) - jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.8.0) - jekyll-sitemap (= 1.4.0) - jekyll-swiss (= 1.0.0) - jekyll-theme-architect (= 0.2.0) - jekyll-theme-cayman (= 0.2.0) - jekyll-theme-dinky (= 0.2.0) - jekyll-theme-hacker (= 0.2.0) - jekyll-theme-leap-day (= 0.2.0) - jekyll-theme-merlot (= 0.2.0) - jekyll-theme-midnight (= 0.2.0) - jekyll-theme-minimal (= 0.2.0) - jekyll-theme-modernist (= 0.2.0) - jekyll-theme-primer (= 0.6.0) - jekyll-theme-slate (= 0.2.0) - jekyll-theme-tactile (= 0.2.0) - jekyll-theme-time-machine (= 0.2.0) - jekyll-titles-from-headings (= 0.5.3) - jemoji (= 0.13.0) - kramdown (= 2.4.0) - kramdown-parser-gfm (= 1.1.0) - liquid (= 4.0.4) + jekyll-readme-index (= 0.1.0) + jekyll-redirect-from (= 0.12.1) + jekyll-relative-links (= 0.4.0) + jekyll-sass-converter (= 1.5.0) + jekyll-seo-tag (= 2.2.3) + jekyll-sitemap (= 1.0.0) + jekyll-swiss (= 0.4.0) + jekyll-theme-architect (= 0.0.4) + jekyll-theme-cayman (= 0.0.4) + jekyll-theme-dinky (= 0.0.4) + jekyll-theme-hacker (= 0.0.4) + jekyll-theme-leap-day (= 0.0.4) + jekyll-theme-merlot (= 0.0.4) + jekyll-theme-midnight (= 0.0.4) + jekyll-theme-minimal (= 0.0.4) + jekyll-theme-modernist (= 0.0.4) + jekyll-theme-primer (= 0.2.1) + jekyll-theme-slate (= 0.0.4) + jekyll-theme-tactile (= 0.0.4) + jekyll-theme-time-machine (= 0.0.4) + jekyll-titles-from-headings (= 0.1.5) + jemoji (= 0.8.0) + kramdown (= 1.13.2) + liquid (= 3.0.6) + listen (= 3.0.6) mercenary (~> 0.3) - minima (= 2.5.1) - nokogiri (>= 1.13.6, < 2.0) - rouge (= 3.30.0) + minima (= 2.1.1) + rouge (= 1.11.1) terminal-table (~> 1.4) - github-pages-health-check (1.18.2) + github-pages-health-check (1.3.3) addressable (~> 2.3) - dnsruby (~> 1.60) - octokit (>= 4, < 8) - public_suffix (>= 3.0, < 6.0) - typhoeus (~> 1.3) - html-pipeline (2.14.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 2.0) + typhoeus (~> 0.7) + html-pipeline (2.6.0) activesupport (>= 2) nokogiri (>= 1.4) - http_parser.rb (0.8.0) - i18n (1.14.1) - concurrent-ruby (~> 1.0) - jekyll (3.9.5) + i18n (0.8.4) + jekyll (3.4.3) addressable (~> 2.4) colorator (~> 1.0) - em-websocket (~> 0.5) - i18n (>= 0.7, < 2) jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 2.0) - kramdown (>= 1.17, < 3) - liquid (~> 4.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.3) + liquid (~> 3.0) mercenary (~> 0.3.3) pathutil (~> 0.9) - rouge (>= 1.7, < 4) + rouge (~> 1.7) safe_yaml (~> 1.0) - jekyll-avatar (0.8.0) - jekyll (>= 3.0, < 5.0) - jekyll-coffeescript (1.2.2) + jekyll-avatar (0.4.2) + jekyll (~> 3.0) + jekyll-coffeescript (1.0.1) coffee-script (~> 2.2) - coffee-script-source (~> 1.12) - jekyll-commonmark (1.4.0) - commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.4.0) - commonmarker (~> 0.23.7) - jekyll (~> 3.9.0) - jekyll-commonmark (~> 1.4.0) - rouge (>= 2.0, < 5.0) - jekyll-default-layout (0.1.5) - jekyll (>= 3.0, < 5.0) - jekyll-feed (0.17.0) - jekyll (>= 3.7, < 5.0) - jekyll-gist (1.5.0) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.9.2) + jekyll (~> 3.3) + jekyll-gist (1.4.0) octokit (~> 4.2) - jekyll-github-metadata (2.16.1) - jekyll (>= 3.4, < 5.0) - octokit (>= 4, < 7, != 4.4.0) - jekyll-include-cache (0.2.1) - jekyll (>= 3.7, < 5.0) - jekyll-mentions (1.6.0) + jekyll-github-metadata (2.3.1) + jekyll (~> 3.1) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.2.0) + activesupport (~> 4.0) html-pipeline (~> 2.3) - jekyll (>= 3.7, < 5.0) - jekyll-optional-front-matter (0.3.2) - jekyll (>= 3.0, < 5.0) + jekyll (~> 3.0) + jekyll-optional-front-matter (0.1.2) + jekyll (~> 3.0) jekyll-paginate (1.1.0) - jekyll-readme-index (0.3.0) - jekyll (>= 3.0, < 5.0) - jekyll-redirect-from (0.16.0) - jekyll (>= 3.3, < 5.0) - jekyll-relative-links (0.6.1) - jekyll (>= 3.3, < 5.0) - jekyll-remote-theme (0.4.3) - addressable (~> 2.0) - jekyll (>= 3.5, < 5.0) - jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) - rubyzip (>= 1.3.0, < 3.0) - jekyll-sass-converter (1.5.2) + jekyll-readme-index (0.1.0) + jekyll (~> 3.0) + jekyll-redirect-from (0.12.1) + jekyll (~> 3.3) + jekyll-relative-links (0.4.0) + jekyll (~> 3.3) + jekyll-sass-converter (1.5.0) sass (~> 3.4) - jekyll-seo-tag (2.8.0) - jekyll (>= 3.8, < 5.0) - jekyll-sitemap (1.4.0) - jekyll (>= 3.7, < 5.0) - jekyll-swiss (1.0.0) - jekyll-theme-architect (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.6.0) - jekyll (> 3.5, < 5.0) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.2.0) - jekyll (> 3.5, < 5.0) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.3) - jekyll (>= 3.3, < 5.0) - jekyll-watch (2.2.1) - listen (~> 3.0) - jemoji (0.13.0) - gemoji (>= 3, < 5) + jekyll-seo-tag (2.2.3) + jekyll (~> 3.3) + jekyll-sitemap (1.0.0) + jekyll (~> 3.3) + jekyll-swiss (0.4.0) + jekyll-theme-architect (0.0.4) + jekyll (~> 3.3) + jekyll-theme-cayman (0.0.4) + jekyll (~> 3.3) + jekyll-theme-dinky (0.0.4) + jekyll (~> 3.3) + jekyll-theme-hacker (0.0.4) + jekyll (~> 3.3) + jekyll-theme-leap-day (0.0.4) + jekyll (~> 3.3) + jekyll-theme-merlot (0.0.4) + jekyll (~> 3.3) + jekyll-theme-midnight (0.0.4) + jekyll (~> 3.3) + jekyll-theme-minimal (0.0.4) + jekyll (~> 3.3) + jekyll-theme-modernist (0.0.4) + jekyll (~> 3.3) + jekyll-theme-primer (0.2.1) + jekyll (~> 3.3) + jekyll-theme-slate (0.0.4) + jekyll (~> 3.3) + jekyll-theme-tactile (0.0.4) + jekyll (~> 3.3) + jekyll-theme-time-machine (0.0.4) + jekyll (~> 3.3) + jekyll-titles-from-headings (0.1.5) + jekyll (~> 3.3) + jekyll-watch (1.5.0) + listen (~> 3.0, < 3.1) + jemoji (0.8.0) + activesupport (~> 4.0) + gemoji (~> 3.0) html-pipeline (~> 2.2) - jekyll (>= 3.0, < 5.0) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) - liquid (4.0.4) - listen (3.9.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) + jekyll (>= 3.0) + kramdown (1.13.2) + liquid (3.0.6) + listen (3.0.6) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) mercenary (0.3.6) - mini_portile2 (2.8.6) - minima (2.5.1) - jekyll (>= 3.5, < 5.0) - jekyll-feed (~> 0.9) - jekyll-seo-tag (~> 2.1) - minitest (5.22.2) - mutex_m (0.2.0) - net-http (0.4.1) - uri - nokogiri (1.16.5) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - octokit (4.25.1) - faraday (>= 1, < 3) - sawyer (~> 0.9) - pathutil (0.16.2) + mini_portile2 (2.2.0) + minima (2.1.1) + jekyll (~> 3.3) + minitest (5.10.1) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) + octokit (4.7.0) + sawyer (~> 0.8.0, >= 0.5.3) + pathutil (0.14.0) forwardable-extended (~> 2.6) - public_suffix (5.0.4) - racc (1.7.3) - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) - rexml (3.3.6) - strscan - rouge (3.30.0) - rubyzip (2.3.2) - safe_yaml (1.0.5) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - simpleidn (0.2.1) - unf (~> 0.1.4) - strscan (3.1.0) + power_assert (0.2.6) + public_suffix (2.0.5) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) + ffi (>= 0.5.0) + rouge (1.11.1) + safe_yaml (1.0.4) + sass (3.4.24) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.1) - ethon (>= 0.9.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) - unicode-display_width (1.8.0) - uri (0.13.0) + test-unit (3.1.5) + power_assert + thread_safe (0.3.6) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.3) + thread_safe (~> 0.1) + unicode-display_width (1.2.1) PLATFORMS ruby DEPENDENCIES github-pages + minitest + test-unit BUNDLED WITH - 2.0.2 + 1.14.6 diff --git a/_config.yml b/_config.yml index 75cfb51..0a0baf1 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,41 @@ -# Set name to prevent title from displaying at the top of the page -# https://github.com/pages-themes/primer/issues/21#issuecomment-440722302 +# Name of your blog (this will show up at the top of your page and in the RSS feed) name: GitHub Games + +# Short description (goes below the title; it will also be used in the RSS feed) +description: This GitHub Games has lots of tests + +# Your name, as you want it to appear underneath each post and in the footer +author: GitHub Training, but forked + +# Your email if you want it to be linked on the contact page +author_email: you@example.com + +# The directory for category index pages. Change it to something else if +# for example you want links like /categories/category1 instead of /category1 +category_dir: / + +# Uncomment if you are planning to run the blog in a subdirectory +# Note - if you enable this, and attempt to view your site locally you have to use the baseurl in your local path. +# Example, you must use http://localhost:4000/path/to/blog +#baseurl: /path/to/blog +# baseurl: + +# The URL of your actual domain. This will be used to make absolute links in the RSS feed. +# url: http://yourdomain.com/ + +#### Under the Hood Stuff ##### + +# Use rdiscount as the markdown engine because it generates html5 compliant code for stuff like footnotes +# If you use maroku (default engine) some of your generated pages may not validate or lint as html5 +# If you don't have it install it via gem install rdiscount +markdown: kramdown + +# Makes pretty (descriptive) permalinks. See Jekyll docs for alternatives. +permalink: pretty + +# How many articles do you wish to appear on the front page: +paginate: 3 + +# Exclude metadata and development time dependencies (like Grunt plugins) +# exclude: [README.markdown, package.json, grunt.js, Gruntfile.js, Gruntfile.coffee, node_modules] +gems: [jekyll-paginate] diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..c0d5ce1 --- /dev/null +++ b/circle.yml @@ -0,0 +1,7 @@ +machine: + ruby: + version: 2.1.5 + +test: + post: + - ruby tests/test_verifyurl.rb diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 2ba71b1..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: '3' -services: - jekyll: - image: 'jekyll/jekyll:3.8' - volumes: - - "$PWD:/srv/jekyll" - ports: - - '4000:4000' - command: jekyll serve --incremental - tty: true diff --git a/package.json b/package.json new file mode 100644 index 0000000..b948723 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "github-games", + "repository": { + "type": "git", + "url": "https://github.com/brianamarie/github-games.git" + }, + "description": "Simple JS game", + "author": "https://twitter.com/brianamarie", + "version": "1.0.0" +} diff --git a/script/check-remotes b/script/check-remotes new file mode 100644 index 0000000..ae4e5e8 --- /dev/null +++ b/script/check-remotes @@ -0,0 +1,51 @@ +#!/bin/sh + +set -e + +# setup environment +export PATH="/usr/share/rbenv/shims:$PATH" + +echo "hostname: $(hostname)" +echo "pwd: $(pwd)" +git --version + +# store remotes in variable +CURRENT_REMOTES=$(git remote -v) + +# print out the remote information +echo $CURRENT_REMOTES + +# set URL stored for origin to ORIGIN variable +ORIGIN=$(git config remote.origin.url) + +# set URL for upstream to UPSTREAM variable +UPSTREAM=$(git config remote.upstream.url) + +# set origin length +ORIGIN_LENGTH=${#ORIGIN} + +# set length of output to size variable +CURRENT_LENGTH=${#CURRENT_REMOTES} + +# set desired length by using remote url +DESIRED_LENGTH=$(($ORIGIN_LENGTH + $ORIGIN_LENGTH + 161)) + +if [ $UPSTREAM = 'https://github.com/githubschool/github-games.git' ] +then + echo "The upstream is GitHubSchool/GitHubGames!" +else + echo "The upstream is incorrect." + exit 1 +fi + + +if [ $DESIRED_LENGTH -eq $CURRENT_LENGTH ] +then + echo "You have an upstream remote set." +else + echo "You do not have an upstream remote set." + exit 1 +fi + + +exit 0 diff --git a/script/server b/script/server deleted file mode 100755 index 24e83dd..0000000 --- a/script/server +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# -# Start the application - -# Exit if docker-compose is not in PATH -if ! command -v docker-compose &>/dev/null; then - echo "Error! Missing dependency: docker-compose. Please install and try again." - exit 1 -fi - -# Exit if the Docker daemon isn't running -if ! docker info &>/dev/null; then - echo "The Docker daemon doesn't appear to be running. Please start Docker and try again." - exit 1 -fi - -# Remove _site directory if it exits -[[ -d _site ]] && rm -r _site - -docker-compose up --build diff --git a/script/test b/script/test deleted file mode 100755 index 408c8dc..0000000 --- a/script/test +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# -# Test the app - if the game loads, everything is working! - -# Create symlink to test game -ln -s inde.html index.html - -# Remove symlink on script exit -trap "rm index.html" EXIT - -# Start app -script/server diff --git a/tests/test_differentcolors.rb b/tests/test_differentcolors.rb new file mode 100644 index 0000000..0e77170 --- /dev/null +++ b/tests/test_differentcolors.rb @@ -0,0 +1,48 @@ +require 'test/unit' + +class TestDifferentColors < Test::Unit::TestCase + + def test_different_colors + #open file and read + file = File.read('./index.html') + + # search for color pieces + color_i_index = file.index('var i') + color_j_index = file.index('var j') + color_l_index = file.index('var l') + color_o_index = file.index('var o') + color_s_index = file.index('var s') + color_t_index = file.index('var t') + color_z_index = file.index('var z') + last_index = file.index('do the bit manipulation') + + color_i = file[color_i_index + 69...color_j_index - 11] + puts color_i + + color_j = file[color_j_index + 69...color_l_index - 11] + puts color_j + + color_l = file[color_l_index + 69...color_o_index - 9] + puts color_l + + color_o = file[color_o_index + 69...color_s_index - 9] + puts color_o + + color_s = file[color_s_index + 69...color_t_index - 10] + puts color_s + + color_t = file[color_t_index + 69...color_z_index - 9] + puts color_t + + color_z = file[color_z_index + 69...last_index - 71] + puts color_z + + # compare all pieces + + color_array = [color_i, color_j, color_l, color_o, color_s, color_t, color_z] + puts color_array.uniq == color_array + + assert(color_array.uniq == color_array, "You have multiple pieces with the same color!") + end + +end diff --git a/tests/test_speeddecrement.rb b/tests/test_speeddecrement.rb new file mode 100644 index 0000000..7f40a4f --- /dev/null +++ b/tests/test_speeddecrement.rb @@ -0,0 +1,27 @@ +require 'test/unit' + +class TestGameDecrement < Test::Unit::TestCase + + def test_game_decrement + # open file to read + file = File.read('./index.html') + + # search for decrement word + decrement_index = file.index('decrement') + min_index = file.index('min:') + puts decrement_index + puts '> ' + puts min_index + + # assign number after decrement to a variable + decrement = file[decrement_index + 11...min_index - 2] + puts decrement + + decrement_less_than_1 = decrement.to_f < 1.0 + decrement_greater_than_0 = decrement.to_f > 0.0 + # assert if that variable is between 0-1 + assert(decrement_less_than_1, "The rate of decrement is too high! Bring 'decrement' above 0 and below 1.") + assert(decrement_greater_than_0, "The rate of decrement is too slow. Bring 'decrement' above 0 and below 1.") + end + +end diff --git a/tests/test_speedmax.rb b/tests/test_speedmax.rb new file mode 100644 index 0000000..2f99067 --- /dev/null +++ b/tests/test_speedmax.rb @@ -0,0 +1,28 @@ +require 'test/unit' + +class TestGameSpeedMax < Test::Unit::TestCase + + def test_game_speed_max + # open file to read + file = File.read('./index.html') + + # search for decrement word + min_index = file.index('min:') + end_index = file.index('}, // how long') + puts min_index + puts '> ' + puts end_index + + # assign number after decrement to a variable + min = file[min_index + 5 ...end_index] + + puts min + + min_less_than_1 = min.to_f < 1.0 + min_greater_than_0 = min.to_f > 0.0 + # assert if that variable is between 0-1 + assert(min_less_than_1, "The speed is too high! Bring 'min' above 0 and below 1.") + assert(min_greater_than_0, "The speed too slow. Bring 'min' above 0 and below 1.") + end + +end diff --git a/tests/test_speedstart.rb b/tests/test_speedstart.rb new file mode 100644 index 0000000..ba6e9be --- /dev/null +++ b/tests/test_speedstart.rb @@ -0,0 +1,28 @@ +require 'test/unit' + +class TestGameStart < Test::Unit::TestCase + + def test_game_start + # open file to read + file = File.read('./index.html') + + # search for decrement word + start_index = file.index('start:') + decrement_index = file.index('decrement:') + puts start_index + puts '> ' + puts decrement_index + + # assign number after decrement to a variable + start = file[start_index + 7...decrement_index - 2] + + puts start + + start_less_than_1 = start.to_f < 1.0 + start_greater_than_0 = start.to_f > 0.0 + # assert if that variable is between 0-1 + assert(start_less_than_1, "The start speed is too high! Bring it above 0 and below 1.") + assert(start_greater_than_0, "The start speed too slow. Bring it above 0 and below 1.") + end + +end diff --git a/tests/test_verifyurl.rb b/tests/test_verifyurl.rb new file mode 100644 index 0000000..fc47c6d --- /dev/null +++ b/tests/test_verifyurl.rb @@ -0,0 +1,46 @@ +require 'test/unit' + +class TestGameStart < Test::Unit::TestCase + + def test_game_start + # open file to read + file = File.read('./README.md') + + # get url for remote + remote = `git config remote.origin.url` + print 'Remote URL: ' + puts remote + + # get username in remote url + split_remote = remote.to_s.split('/') + username_remote_ssh = split_remote[1] + username_remote_https = split_remote[4] + if + username_remote_ssh.length > 0 + then + username_remote = username_remote_ssh + else username_remote = username_remote_https + end + + user_remote_split = username_remote.to_s.split('.') + user_remote = user_remote_split[0] + print 'Username in remote: ' + puts user_remote + + # search for README url, assign to link + link_index = file.index('at:') + link_end_index = file.index('>> _*SUP') + link = file[link_index + 4...link_end_index - 3] + + # get username from link in readme + split_readme = link.to_s.split('/') + username_readme = split_readme[3] + print 'Username in README: ' + puts username_readme + + + # compare those strings, pass test if they're equal + assert_equal(user_remote, username_readme, "The URL to the game in the README.md doesn't match the username in the remote repository.") + end + +end