Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.