Skip to content

Instantly share code, notes, and snippets.

@alan-andrade
Created October 15, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alan-andrade/8c91529a723e828065ee to your computer and use it in GitHub Desktop.
Save alan-andrade/8c91529a723e828065ee to your computer and use it in GitHub Desktop.
typedef NSUInteger LLWorkoutIndex;
typedef enum : LLWorkoutIndex {
LLFitTestExperience = 0,
LLBMIExperience = 1,
LLScriptedExperience = 7,
} LLWorkoutExperince;
@interface LLExperience : NSObject
+ (LLWorkoutIndex)indexForWorkoutExperience:(LLWorkoutExperince)experience;
@end
@implementation LLExperience
+ (LLWorkoutIndex)indexForWorkoutExperience:(LLWorkoutExperince)experience
{
switch (experience) {
case LLFitTestExperience:
return (LLWorkoutIndex)0;
case LLBMIExperience:
return (LLWorkoutIndex)1;
case LLScriptedExperience:
return (LLWorkoutIndex)7;
}
}
@end
// OR
// Static dictionary ? Or just the enum ?
SpecBegin(LLTrainer)
describe(@"LLWorkoutExperience", ^{
describe(@"indexForWorkoutExperience", ^{
context(@"for FitTest", ^{
it(@"should be 0", ^{
LLWorkoutIndex index = [LLExperience indexForWorkoutExperience:LLFitTestExperience];
expect(index).to.equal(0);
});
});
context(@"for Bmi", ^{
it(@"should be 1", ^{
});
});
context(@"for Scripted", ^{
it(@"should be 7", ^{
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment