Skip to content

Instantly share code, notes, and snippets.

View badrinathvm's full-sized avatar

Badarinath Venkatnarayansetty badrinathvm

View GitHub Profile
@badrinathvm
badrinathvm / WatchTest.swift
Last active October 14, 2017 20:47
Modal Unit Tests
import Foundation
import Nimble
import Quick
@testable import UnitTests
class Dummy{}
class WatchTest: QuickSpec{
@badrinathvm
badrinathvm / WatchUnitTest.swift
Last active October 14, 2017 22:37
Unit Test skeleton
override func spec() {
var watch : Watch!
//Component (i.e., Watch Modal Data ) in test
describe("Watch Modal Data Tests"){
//Preparation of data
beforeEach {
watch = Watch(name: "Men's Business Quartz Watch CAGNARY 6828",
price: 11.69, brand: Brand(id: 6828, name: "CAGARNY"))
@badrinathvm
badrinathvm / Watch.Swift
Last active October 14, 2017 22:29
Watch Class
import Foundation
struct Watch {
var name:String
var price: Double
var brand: Brand
}
struct Brand {
var id: Int
@badrinathvm
badrinathvm / QuickStructure.swift
Last active October 14, 2017 22:40
Quick Structure
class QuickStructure: QuickSpec{
override func spec() {
describe("Component to be Verified"){
beforeEach {
//set up data
}
context("State of Test Case"){
it(" Expect Validations "){
@badrinathvm
badrinathvm / Expects.swift
Last active October 14, 2017 22:46
file containing expects
//class check
expect(watch).to(beAKindOf(Watch.self))
expect(watch).toNot(beAKindOf(Dummy.self))
//instance check
expect(watch).to(beAnInstanceOf(Watch.self))
expect(watch).toNot(beAnInstanceOf(Dummy.self))
//string and name presence check
expect(watch.name).to(beAnInstanceOf(String.self))
@badrinathvm
badrinathvm / PriceExpects.swift
Last active October 14, 2017 23:33
Price Validations
it("Price validations"){
expect(watch.price).toNot(beNil())
expect(watch.price).to(beTruthy())
//evaluating boundary cases
expect(watch.price).toNot(beLessThan(0))
expect(watch.price).to(beCloseTo(11, within: 0.69))
expect(watch.price).to(beLessThanOrEqualTo(11.69))
expect(watch.price).to(beGreaterThan(Double.pi))
expect(watch.price).toNot(beGreaterThan(11.69))
[
{ "uid": 1, "name": "Avengers: Infinity War", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/avg.jpg", "category": 1, "venue": 1 },
{ "uid": 2, "name": "Deadpool 2", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/deadpool.jpg", "category": 1, "venue": 2 },
{ "uid": 3, "name": "Solo: A Star Wars Movie", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/solo.jpg", "category": 1, "venue": 3 },
{ "uid": 4, "name": "Game Night", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/gamenight.jpg", "category": 2, "venue": 1 },
{ "uid": 5, "name": "Blockers", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/blockers.jpg", "category": 2, "
@badrinathvm
badrinathvm / sample.json
Created January 6, 2019 01:48
sample.json
[
{ "uid": 1, "name": "Avengers: Infinity War", "shortDesc": "Lorem Ipsum", "duration": 120, "thumbnailUrl": "https://s3.amazonaws.com/mobile.scribd.com/ios-interview-test/avg.jpg", "category": 1, "venue": 1 },
]
{
"user_data": {
"full_name": "John Sundell",
"user_age": 31
}
}
//
// CreditCardListViewController.swift
// BUPNative
//
// Created by Venkatnarayansetty, Badarinath on 7/24/19.
//
import Foundation
import UIKit