wingify_devfest_citd 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/wingify_devfest_citd +42 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7beaa67afe3c37796240dd3d8b491729215bf1e0
|
4
|
+
data.tar.gz: 17c5cca2da9b90a9bbacb37b805a381a25ad847c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79c469c1b94338a55efbe8f1b5779e37cf4784dfbd68eceebc10fbb7d7605bfd0161569c729ad33f9086cec18ee536e9a00b84b8fcc78552c1e818ba343461f5
|
7
|
+
data.tar.gz: 272e452030265129950630e2f23a7aa1d3fa96d53a1c91645036abda79dbfaab196f3b30c8d90ed8190d06048a49c05bdbef2c2de35174d4a1cc959742788f23
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'openssl'
|
4
|
+
require 'base64'
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
EXECUTER = ARGV[0]
|
8
|
+
FILENAME = ARGV[1]
|
9
|
+
KEY = ARGV[2]
|
10
|
+
TEST_CASE_FILE = ARGV[3]
|
11
|
+
|
12
|
+
def encrypt(msg)
|
13
|
+
return -1 if msg == ''
|
14
|
+
encrypter = OpenSSL::Cipher::AES.new(128, :CBC)
|
15
|
+
encrypter.encrypt
|
16
|
+
encrypter.pkcs5_keyivgen KEY, 'wingify1'
|
17
|
+
# cipher.iv = OpenSSL::PKey::RSA.new('wingify')
|
18
|
+
encrypted = encrypter.update msg
|
19
|
+
encrypted << encrypter.final
|
20
|
+
Base64.encode64(encrypted).encode('utf-8').gsub("\n", "").chomp
|
21
|
+
end
|
22
|
+
|
23
|
+
def assert(expected_output, input)
|
24
|
+
puts "\nRunning Test Case #{input}"
|
25
|
+
start = Time.now.to_f
|
26
|
+
result = expected_output.chomp == encrypt(`#{EXECUTER} #{FILENAME} #{input}`.chomp) ? 'PASS' : 'FAIL'
|
27
|
+
time = Time.now.to_f - start
|
28
|
+
puts "Result: #{result}, Time: #{time.round(2)}"
|
29
|
+
return result == 'PASS' ? 1 : 0
|
30
|
+
end
|
31
|
+
|
32
|
+
total = 0
|
33
|
+
|
34
|
+
file_data = open(TEST_CASE_FILE) { |infile| infile.read }.split("\n")
|
35
|
+
file_data.each do |line|
|
36
|
+
expected_output = line.split('##--##')[0].chomp
|
37
|
+
input = line.split('##--##')[1].chomp
|
38
|
+
total += assert(expected_output, input)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
puts "\n\nTotal score #{total}"
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wingify_devfest_citd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sahil Batla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Evaluate Code & Check Test Cases In a File
|
14
|
+
email: sahilbathla1@gmail.com
|
15
|
+
executables:
|
16
|
+
- wingify_devfest_citd
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/wingify_devfest_citd
|
21
|
+
homepage: http://rubygems.org/gems/wingify_devfest_citd
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.6.12
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Evaluate Code & Check Test Cases
|
45
|
+
test_files: []
|