├── ruby ├── translator.rb ├── README.md ├── Gemfile └── translator.test.rb ├── javascript ├── translator.js ├── README.md ├── package.json └── translator.test.js ├── python ├── translator.py ├── README.md └── translator.test.py ├── typescript ├── translator.ts ├── README.md ├── jest.config.js ├── package.json └── translator.test.ts ├── go ├── README.md ├── translator.go ├── go.mod └── translator_test.go ├── .gitignore ├── braille.jpg ├── .github └── workflows │ ├── go.yml │ ├── ruby.yml │ ├── javascript.yml │ ├── python.yml │ └── typescript.yml └── README.md /ruby/translator.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /javascript/translator.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/translator.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /typescript/translator.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /go/README.md: -------------------------------------------------------------------------------- 1 | # Go Instructions -------------------------------------------------------------------------------- /go/translator.go: -------------------------------------------------------------------------------- 1 | package main 2 | -------------------------------------------------------------------------------- /ruby/README.md: -------------------------------------------------------------------------------- 1 | # Ruby Instructions -------------------------------------------------------------------------------- /go/go.mod: -------------------------------------------------------------------------------- 1 | module solution 2 | 3 | go 1.21.5 -------------------------------------------------------------------------------- /javascript/README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Instructions -------------------------------------------------------------------------------- /typescript/README.md: -------------------------------------------------------------------------------- 1 | # TypeScript Instructions -------------------------------------------------------------------------------- /ruby/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "rspec" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | yarn.lock 4 | package-lock.json 5 | Gemfile.lock -------------------------------------------------------------------------------- /braille.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrandonXLF/eng-intern-challenge/main/braille.jpg -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # Python Instructions 2 | 3 | Note that the Python version used is 3.8 4 | -------------------------------------------------------------------------------- /typescript/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node', 4 | }; -------------------------------------------------------------------------------- /javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "javascript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "translator.js", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "jest": "^29.7.0" 13 | } 14 | } -------------------------------------------------------------------------------- /ruby/translator.test.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe 'Braille Translator Script' do 2 | it 'outputs the correct string' do 3 | output = `ruby translator.rb Abc 123 xYz` 4 | expect(output.strip).to eq('.....OO.....O.O...OO...........O.OOOO.....O.O...OO..........OO..OO.....OOO.OOOO..OOO') 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "translator.ts", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/jest": "^29.5.12", 14 | "@types/node": "^20.12.7", 15 | "jest": "^29.7.0", 16 | "ts-jest": "^29.1.2", 17 | "ts-node": "^10.9.2", 18 | "typescript": "^5.4.5" 19 | } 20 | } -------------------------------------------------------------------------------- /typescript/translator.test.ts: -------------------------------------------------------------------------------- 1 | import { exec } from 'child_process'; 2 | import { promisify } from 'util'; 3 | 4 | const execAsync = promisify(exec); 5 | 6 | describe('translator.ts output', () => { 7 | it('should print the correct output to the console', async () => { 8 | const { stdout } = await execAsync('ts-node translator.ts Abc 123 xYz'); 9 | 10 | const expected = '.....OO.....O.O...OO...........O.OOOO.....O.O...OO..........OO..OO.....OOO.OOOO..OOO'; 11 | expect(stdout.trim()).toBe(expected); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /javascript/translator.test.js: -------------------------------------------------------------------------------- 1 | const { exec } = require("child_process"); 2 | 3 | describe('translator.js script', () => { 4 | it('should output correct answer to the console', (done) => { 5 | exec("node translator.js Abc 123 xYz", (error, stdout, stderr) => { 6 | expect(error).toBeNull(); 7 | expect(stderr).toBe(""); 8 | expect(stdout.trim()).toBe(".....OO.....O.O...OO...........O.OOOO.....O.O...OO..........OO..OO.....OOO.OOOO..OOO"); 9 | done(); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'go/**' 9 | 10 | jobs: 11 | go-tests: 12 | name: Run Go Tests 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - id: changes 18 | uses: jitterbit/get-changed-files@v1 19 | 20 | - name: Set up Go 21 | uses: actions/setup-go@v2 22 | with: 23 | go-version: '1.21.5' 24 | 25 | - name: Run Go Tests 26 | run: cd go && go test ./... -------------------------------------------------------------------------------- /.github/workflows/ruby.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'ruby/**' 9 | 10 | jobs: 11 | ruby-tests: 12 | name: Run Ruby Tests 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout Code 16 | uses: actions/checkout@v2 17 | 18 | - name: Setup Ruby 19 | uses: ruby/setup-ruby@v1 20 | with: 21 | ruby-version: '3.0' 22 | bundler-cache: true 23 | 24 | - run: cd ruby && bundle install 25 | - run: cd ruby && rspec translator.test.rb -------------------------------------------------------------------------------- /.github/workflows/javascript.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'javascript/**' 9 | 10 | jobs: 11 | javascript-tests: 12 | name: Run JavaScript Tests 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - id: changes 17 | uses: jitterbit/get-changed-files@v1 18 | - name: Setup Node.js 19 | uses: actions/setup-node@v2 20 | with: 21 | node-version: '15' 22 | - run: cd javascript && npm install 23 | - run: cd javascript && npm test -------------------------------------------------------------------------------- /.github/workflows/python.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'python/**' 9 | 10 | jobs: 11 | python-tests: 12 | name: Run Python Tests 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - id: changes 18 | uses: jitterbit/get-changed-files@v1 19 | 20 | - name: Set up Python 21 | uses: actions/setup-python@v2 22 | with: 23 | python-version: '3.8' 24 | 25 | - name: Run Python Tests 26 | run: | 27 | cd python 28 | python3 translator.test.py -------------------------------------------------------------------------------- /go/translator_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os/exec" 5 | "strings" 6 | "testing" 7 | ) 8 | 9 | func TestSolutionOutput(t *testing.T) { 10 | cmd := exec.Command("go", "run", "translator.go", "Abc", "123", "xYz") 11 | outputBytes, err := cmd.CombinedOutput() 12 | if err != nil { 13 | t.Fatalf("Failed to run the command: %v", err) 14 | } 15 | 16 | // Trim space from output and expected value 17 | output := strings.TrimSpace(string(outputBytes)) 18 | expected := strings.TrimSpace(".....OO.....O.O...OO...........O.OOOO.....O.O...OO..........OO..OO.....OOO.OOOO..OOO") 19 | 20 | if output != expected { 21 | t.Errorf("Unexpected output, got: %q, want: %q", output, expected) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/typescript.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'typescript/**' 9 | 10 | jobs: 11 | typescript-tests: 12 | name: Run TypeScript Tests 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - id: changes 18 | uses: jitterbit/get-changed-files@v1 19 | 20 | - name: Setup Node.js 21 | uses: actions/setup-node@v2 22 | with: 23 | node-version: '14' 24 | 25 | - name: Install dependencies 26 | run: | 27 | cd typescript 28 | npm install 29 | 30 | - name: Run TypeScript Tests 31 | run: | 32 | cd typescript 33 | npm test -------------------------------------------------------------------------------- /python/translator.test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import subprocess 3 | 4 | class TestTranslator(unittest.TestCase): 5 | def test_output(self): 6 | # Command to run translator.py script 7 | command = ["python3", "translator.py", "Abc", "123", "xYz"] 8 | 9 | # Run the command and capture output 10 | result = subprocess.run(command, capture_output=True, text=True) 11 | 12 | # Expected output without the newline at the end 13 | expected_output = ".....OO.....O.O...OO...........O.OOOO.....O.O...OO..........OO..OO.....OOO.OOOO..OOO" 14 | 15 | # Strip any leading/trailing whitespace from the output and compare 16 | self.assertEqual(result.stdout.strip(), expected_output) 17 | 18 | if __name__ == '__main__': 19 | unittest.main() 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Eng Intern Challenge Fall - Winter 2025 2 | 3 | # **Note: In order for our submission automation to function correctly:** 4 | 1. **Your Github email must match the email you submitted your Application with (if your Github email is different, we recommend creating a new Github profile with the email you created your application with)** 5 | 2. **Have your email set to public on your Github Profile** 6 | 3. **Do not apply any labels on your PR. We will mark your PR as `reviewed` with a label when it has been so. Marking this yourself will cause your PR to be skipped.** 7 | 8 | **If you have any questions, please reach out to `internprogram@shopify.com`** 9 | 10 | --- 11 | 12 | ## Braille Translator 13 | In this coding challenge you will create a terminal / command-line application that can translate Braille to English and vice versa. 14 | 15 | The string to translate will be passed into your application as an argument at runtime. Your application must be smart enough to determine if the string given to it is either Braille or English and automatically convert it to the appropriate opposite. 16 | 17 | For the purposes of this challenge Braille must be displayed as `O` and `.` where `O` represents a raised dot. You must include the entire English alphabet, the ability to `capitalize` letters, add `spaces`, and the numbers `0` through `9` as well. 18 | 19 | After conversion, output the translated string--and nothing else--to the terminal. 20 | 21 | ## What is Braille? 22 | Braille (*/breɪl/ **BRAYL***) is a tactile writing system used by people who are visually impaired. Braille characters are formed using a combination of six raised dots arranged in a 3 × 2 matrix, called the braille cell. The number and arrangement of these dots distinguishes one character from another. ([via Wikipedia](https://en.wikipedia.org/wiki/Braille)) 23 | 24 |
25 |
26 |
28 | Black dots represent raised areas 29 |
30 | 31 | ## Technical Requirements 32 | - Translator 33 | - Given arguments passed into the program at runtime, determine if the given string should be translated to English or Braille. 34 | - For Braille, each character is stored as a series of `O` (the letter O) or `.` (a period). 35 | - Store Braille symbols as a 6 character string reading left to right, line by line, starting at the top left. See examples below. 36 | - When a Braille `capital follows` symbol is read, assume only the next symbol should be capitalized. 37 | - When a Braille `number follows` symbol is read, assume all following symbols are numbers until the next `space` symbol. 38 | - Braille Alphabet 39 | - Letters `a` through `z` 40 | - The ability to capitalize letters 41 | - Numbers `0` through `9` 42 | - The ability to include `spaces` ie: multiple words 43 | 44 | ## Examples 45 | - Launching your application with English or Braille: 46 | - `ruby translator.rb Hello world` 47 | - `ruby translator.rb .....OO.OO..O..O..O.O.O.O.O.O.O..OO........OOO.OO..OO.O.OOO.O.O.O.OO.O..` 48 | --- 49 | - Input: `Hello world` 50 | - Output: `.....OO.OO..O..O..O.O.O.O.O.O.O..OO........OOO.OO..OO.O.OOO.O.O.O.OO.O..` 51 | --- 52 | - Input: `42` 53 | - Output: `.O.OOOOO.O..O.O...` 54 | --- 55 | - Input: `.....OO.....O.O...OO...........O.OOOO.....O.O...OO....` 56 | - Output: `Abc 123` 57 | 58 | ## Instructions 59 | 1. Fork this repo to your personal Github Account 60 | 1. Clone your forked repo to begin working on the challenge locally. 61 | 2. Create a new Branch in your repo where you will be pushing your code to. 62 | 3. Choose which programming language you wish to complete the challenge with. 63 | - Navigate to the folder of that programming language and complete your work in the `translator` file found inside. ie: `ruby/translator.rb` 64 | - **Do not** edit the test file in the folder. Tests will only work as intended after you have submitted a PR. 65 | - You'll find a separate `README.md` in that folder with language specific instructions. 66 | 4. Ensure your application is executable from the command-line by running your `translator` file. 67 | 5. Feel free to run the test found in your language folder to ensure your code is correct 68 | 6. Your application must output ***only*** the Braille/English string. 69 | - ie: `O.....` ***not*** `The Braille text is: O.....` 70 | 71 | ## Submission 72 | Upon completion of the challenge, create a PR of your work and compare it against the original Assessment Repo's main branch. Submit a link to your PR in the "Take Home Submission Link" which was included in the Technical Challenge email instructions. 73 | 74 | **Note: In order for our submission automation to function correctly:** 75 | - Your Github email must match the email you submitted your Application with (if your Github email is different, we recommend creating a new Github profile with the email you created your application with) 76 | - Have your email set to public on your Github Profile 77 | - Do not apply any labels on your PR. We will mark your PR as `reviewed` with a label when it has been so. Marking this yourself will cause your PR to be skipped. 78 | 79 | This repo is designed to run a unit test against your work to ensure the correct string is outputted to the console when executing your code. 80 | --------------------------------------------------------------------------------